Monday, May 18, 2009

SetPixel in Vista 64 bits

(May 18, 2009)

SetPixel in Vista 64 bits is affected by Aero Glass capability. If we disable Aero Glass, SetPixel will work correctly only around half of the bitmap. For example, if our image is of size 512 x 512, only the first or the second half of the bitmap plane will work fine. In my machine, columns 257 and later will not get affected by SetPixel.

This is a long standing bug in Vista 64 bits, as discussed at http://social.msdn.microsoft.com/Forums/en-US/windowsuidevelopment/thread/4ac40f47-6b44-46c4-869d-38a594d9a4f3.

Workaround is just enabling the Aero Glass theme or use FillRect of size 1 pixel, as shown
http://social.msdn.microsoft.com/Forums/en-US/windowsuidevelopment/thread/9100f5cc-dbc9-4b4a-a46f-23c434d76e87/