The information in this article applies to:
SYMPTOMSWhen calling CreateCompatibleBitmap() on Windows NT, the operating system returns a bitmap where all of the pixels are initialized to BLACKNESS. On Windows 95, however, the operating system will not initialize the bits. This behavioral difference frequently shows up when software is developed on Windows NT and then later tested on Windows 95. CAUSEWindows NT initializes the contents of the bitmap for security reasons. Windows 95 does not provide the same level of security as Windows NT and, therefore, does not initialize the bits. You should always treat newly-created memory bitmaps as though they were uninitialized. You should initialize them yourself prior to drawing on them. RESOLUTIONFortunately, this behavioral difference is easy to work around. The simplest way is to PatBlt() the surface of the memory bitmap with BLACKNESS after it is created. For example, to alter the function below so it produces the same behavior on both Windows 95 and Windows NT, add the following line of code immediately after the call to SelectObject():
STATUSThis behavior is by design. REFERENCESThe following code fragment demonstrates the problem. When you run it on Windows NT, it will set the client area of the window corresponding to the HWND parameter to all black. When you run the same code on Windows 95, the window will be filled with whatever the image representing the uninitialized contents of the bitmap memory is:
Additional query words: 3.51 4.00 beta99 kbdsi
Keywords : kbNTOS351 kbNTOS400 kbWinOS2000 kbSDKWin32 kbWinOS95 kbDSupport |
Last Reviewed: December 20, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |