PRB: CButton SetIcon and SetBitmap Work Only Under Windows 95 (142226)
The information in this article applies to:
- The Microsoft Foundation Classes (MFC), when used with:
- Microsoft Visual C++, 32-bit Editions 4.0
This article was previously published under Q142226 SYMPTOMS
When a button is displayed on Windows NT, which uses these functions and
styles, the button will not appear. If you click in the area that the
button should be, you will get an outline of a check-box button.
CAUSE
Windows NT does not support the BS_ICON and BS_BITMAP styles.
RESOLUTION
Only use these features of CButton when the Windows version is greater than
or equal to 4.
Remove the BS_ICON or BS_BITMAP style from the dialog template. Then use
GetVersion to determine the Windows version. If the version is greater than
or equal to 4, use ModifyStyle to add the BS_ICON or BS_BITMAP style and
call SetIcon or SetBitmap. See the "Sample Code" section of this article.
Using this method, under Windows NT the user will see the text caption
version of the button, but under Windows 95 the desired icon or bitmap will
be seen.
REFERENCES
Win32 SDK BM_SETIMAGE documentation
Modification Type: | Major | Last Reviewed: | 10/24/2003 |
---|
Keywords: | kbBitmap kbButton kbcode kbIcon kbprb KbUIDesign KB142226 |
---|
|