.code
invoke GetDesktopWindow
invoke GetDC,eax
invoke GetPixel,eax,500,600
WHy does this code not work? It returns -1 (=FFFFFFFF = white) for every pixel.
I think that you get the desktop DC with the parameter 0, not the return of GetDeskTopWindow (I'm not sure what that function does.)
-1 (0ffffffffh) is fail, not white :bdg
(000ffffffh would be white)
Anyway, the following appears to work for me (on Win2k anyway)
invoke GetDC, 0
mov hddc,eax
invoke SetPixel, hddc,1,1,0ffh ;set pixel to red
If you're planning on using GetPixel to grab the screen - good luck!!
- it's extremely slow
- windows on top of the desktop are not PART of the desktop, ie. you will get an image of the desktop without the windows on it