Owner Notifications

The owner window of a graphic button is sent a notification code with the WM_CONTROL message whenever the graphic button changes state. The notification code indicates the new state of the button. WM_CONTROL messages are sent with WinSendMsg, which does not return until the application processes the message. These notifications are provided for an application that requires synchronous knowledge of when a graphic button changes state. An example of this type of graphic button is the music scan button shown in the example in section Processing Messages for a CD Player Graphic Button.

At the same time a WM_CONTROL message is sent to the owner, a WM_COMMAND message is also posted to the application message queue with WinPostMsg. The WM_COMMAND informs the application that the graphic button has been selected. If you want to implement a simple graphic button that performs an action, such as a playback operation, you can use code developed for a PM pushbutton, which uses the WM_COMMAND means of notification. The only change you have to make to the code is the window class.

When you create your graphic button, you can take advantage of either of these means of notification.

┌────────────────────────┬────────────────────────────────────┐
│Notification Code       │Description                         │
├────────────────────────┼────────────────────────────────────┤
│GBN_BUTTONUP            │The graphic button is changing to an│
│                        │up paint state from either a down or│
│                        │highlighted paint state.            │
├────────────────────────┼────────────────────────────────────┤
│GBN_BUTTONDOWN          │The graphic button is changing to a │
│                        │down paint state from either an up  │
│                        │or highlighted paint state.         │
├────────────────────────┼────────────────────────────────────┤
│GBN_BUTTONHILITE        │The graphic button is changing to a │
│                        │highlighted paint state from either │
│                        │an up or down paint state.          │
└────────────────────────┴────────────────────────────────────┘


[Back: Styles]
[Next: Control Messages]