PRB: Private Button Class Cannot Get BM_SETSTYLE in Windows 95

ID: Q130951

The information in this article applies to:

SYMPTOMS

When an application creates a new button class, the new buttons do not receive BM_SETSTYLE messages under Windows 95.

CAUSE

In previous versions of Windows, the new button had only to return DLGC_BUTTON in response to the WM_GETDLGCODE message. This was all that was required to identify the window as a "button."

However, in Windows 95, returning DLGC_BUTTON to WM_GETDLGCODE is no longer sufficient to identify the window as a "button." The dialog manager code in Windows 95 is implemented in 16 bits. When a message is dispatched to a 32-bit window, the system automatically generates a thunk. Because the system does not know that the new class is actually a "button," it does not automatically perform the thunk - so the BM_SETSTYLE messages are not sent.

RESOLUTION

To tell the system to treat the window as a "button," the window must call one of the following APIs at least once:

   IsDlgButtonChecked
   CheckRadioButton
   CheckDlgButton

The preferable method for doing this is to call IsDlgButtonChecked during the WM_CREATE message. Once this is done, the window will receive all standard button messages.

STATUS

This behavior is by design.

Additional query words:

Keywords          : kbButton kbCtrl kbGrpUser kbWinOS95 kbWndw kbWndwClass 
Issue type        : kbprb

Last Reviewed: January 2, 1999