hi, im a new member and this is my first post..
I need to take a screen shot in windows xp sp2 or other windows, and save that screen shot to a file .
The first part is easy , i can do that by calling the keyboard event function of the windows api . But the second part is weird , i have not been able to find some solution to it.. Any help is appreciated. Thankyou in advance.
Regards,
Mohsin.
I have attached a procedure that will do the job. It can be used like this:
invoke GetDesktopWindow
mov hWndDesktop, eax
invoke GetWindowImage, hWndDesktop
mov bitmap, eax
The code for saving the Desktop to a bitmap file is considerably longer than what 2-bit chip has in his zip, although he starts things out correctly, that code merely pushes the HBITMAP (bitmap handle) to the stack.
Once the BitBlt copies the pixel data to a memory location, you must initialize the BITMAPINFO structure, (this information can be determined by calling GetObject, and passing the HBITMAP). Then typically, you call GetDIBits to retrieve the size of the Pixel data, passing NULL for the BITMAPINFO structure (which returns the size of the pixel data), and dynamically allocate an array to hold the copied pixel data, and call GetDIBits again (with the complete BITMAPINFO structure) to write this data into memory in the native Bitmap format. Finally, you must write the BITMAPHEADER, and then write all that data in the correct sequence to a new file. It's easy to screw it up.
Hi sp3tsnaz ,
Welcome to the forum.
Saving the desktop to a BMP (http://www.masm32.com/board/index.php?topic=10846.0)