Capturing an Image

Recommended Posts

andd 1

andd 1

I was wondering if there is any way to do screenshots with AutoIt. At first I coded a *.dll in Delphi which saves the entire screen, or a window given by its handle, to an image in jpeg-format.

Then I noticed, that there already exists an *.dll in this forum, which does nearly the same. So I decided to do it only with AutoIt by using standard DllCalls.

Windows handles the entire screen like a common window, so you can get its handle by using the "GetDesktopWindow" dllcall of the user32.dll. For the picture information you need to get the device context by calling "GetWindowDC". Now you create a compatible device context (in memory) where you can store the picture information of the screen. Before copying the data via bit block transfer, you have to create a compatible bitmap and select it to the compatible device context to store the exact picture information (otherwise it would be monochrom).

Now I'm so far, that I can capture an image, for example the whole screen or just a window. I got help from MSDN and made it with AutoIt.