PRB: Private Button Class Cannot Get BM_SETSTYLE in Windows 95
Article ID: 130951
Article Last Modified on 7/11/2005
APPLIES TO
- Microsoft Platform Software Development Kit-January 2000 Edition, when used with:
- Microsoft Windows 2000 Standard Edition
This article was previously published under Q130951
SYMPTOMS
When an application creates a new button class, the new buttons do not
receive BM_SETSTYLE messages under Windows 95 or Windows 2000.
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 and Windows 2000, returning DLGC_BUTTON to WM_GETDLGCODE is no longer sufficient to identify the window as a "button." The dialog manager code 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.
Keywords: kbbutton kbctrl kbprb kbwndw kbwndwclass KB130951