Loads a bitmap from the specified rectangle within a device context.
L_LTDIS_API L_INT L_ScreenCaptureBitmap(hDC, pBitmap, uStructSize, pRect)
Handle to the source device. The mapping mode of the device context must be MM_TEXT.
Pointer to the bitmap handle referencing the target bitmap.
Size in bytes, of the structure pointed to by
pBitmap, for versioning. Use sizeof(BITMAPHANDLE).
The windows RECT structure that specifies the portion of the device context to capture.
|SUCCESS||The function was successful.|
|< 1||An error occurred. Refer to Return Codes.|
Normally, this function is used for capturing images displayed on the screen. The resulting bitmap will have the same bits per pixel as the display device.
Before calling this function, you must declare a bitmap handle, but do not allocate the bitmap. This function allocates the bitmap.
LEAD provides several other screen capture functions for increased versatility in capturing images from the screen. For more information, refer to the LEADTOOLS Screen Capture C API help.
For a complete sample code, refer to the FRAME.C module of the DEMO example.
This example captures the whole screen.
L_INT ScreenCaptureBitmapExample(L_HWND hWnd, pBITMAPHANDLE pBitmap)
RECT ScreenRect; /* Rectangle for the whole screen */
HDC ScreenDC; /* Device context for the whole screen */
/* Get the device context for the whole screen */
ScreenDC = GetDC(NULL);
/* Get the rectangle for the whole screen */
SetRect(&ScreenRect, 0, 0, GetDeviceCaps(ScreenDC, HORZRES), GetDeviceCaps(ScreenDC, VERTRES));
/* Capture the whole screen */
nRet = L_ScreenCaptureBitmap(ScreenDC, pBitmap, sizeof(BITMAPHANDLE), &ScreenRect);
if (nRet != SUCCESS)
/* The palette might have changed */
SendMessage(hWnd, WM_QUERYNEWPALETTE, 0, 0L);
/* Release the device context */
Medical Web Viewer .NET
.NET, Java, Android, and iOS/macOS Assemblies
C API/C++ Class Libraries