News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Problem with "print screen" code

Started by AeroASM, April 25, 2005, 01:55:57 PM

Previous topic - Next topic

AeroASM


.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.

Bieb

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.)

Tedd

-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
No snowflake in an avalanche feels responsible.