Bitmap

This program shows how to capture a bitmap of a control, window or screen. The image is returned as a blob variable which can be written to disk as a .bmp file. The capture function optionally will save the image to the clipboard. It also uses the RunAndWait object to load the .bmp into your image editor.

To use this in PB 12.6 and higher, you must add progma_pack(1) to the external function declarations of CopyBitmapFileHeader and CopyBitmapInfo. This is due to a change in the default structure alignment.



Win API Functions used:

BitBlt
CloseClipboard
CreateCompatibleBitmap
CreateCompatibleDC
DeleteDC
EmptyClipboard
FormatMessage
GetDC
GetDesktopWindow
GetDIBits
GetLastError
GetTempPath
OpenClipboard
ReleaseDC
RtlMoveMemory
SelectObject
SetClipboardData
StretchBlt


——— Last updated 03/16/2010 ———