Microsoft KB Archive/130951

{|
 * width="100%"|

PRB: Private Button Class Cannot Get BM_SETSTYLE in Windows 95

 * }

Q130951

-

The information in this article applies to:


 * Microsoft Win32 Software Development Kit (SDK), used with:
 * Microsoft Windows 95
 * the operating system: Microsoft Windows 2000

-

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.

Additional query words:

Keywords : kbButton kbCtrl kbOSWin2000 kbSDKWin32 kbGrpDSUser kbOSWin95 kbWndw kbWndwClass

Issue type : kbprb

Technology : kbWin32SDKSearch kbAudDeveloper kbSDKSearch kbWin32sSearch