Creating Graphic Buttons

The graphic button PM window class WC_GRAPHICBUTTON is similar to the window class of a push button. This window class must be registered with the function WinRegisterGraphicButton before you can create a graphic button.

A graphic button can be created by a CONTROL statement in a dialog resource. A graphic button also can be created by specifying the WC_GRAPHICBUTTON window class parameter of the WinCreateWindow call.

The graphic button should be initialized when its owner receives a WM_INITDLG message. By doing the initializations at this time, the owner has the capability to change the graphic button's bitmaps, text positioning, state, animation rate, and so on, before the button is displayed on the screen.

The GBTNCDATA data structure shown below is the data structure that is allocated to initialize graphic button control data. This structure is required when sending the GBM_SETGRAPHICDATA message.

Note: If you create a graphic button with WinCreateWindow and initialize the GBTNCDATA structure; set the usReserved field to GB_STRUCTURE, rather than GB_RESOURCE, to indicate the structure contains a module handle.