#include "l_bitmap.h"
L_LTDIS_API L_INT L_ScreenCaptureBitmap(hDC, pBitmap, uStructSize, pRect)
Loads a bitmap from the specified rectangle within a device context.
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.
Value | Meaning |
---|---|
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.
Required DLLs and Libraries
Win32, x64.
For 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)
{
L_INT nRet;
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 */
if(pBitmap->Flags.Allocated)
L_FreeBitmap(pBitmap);
nRet = L_ScreenCaptureBitmap (ScreenDC, pBitmap, sizeof(BITMAPHANDLE), &ScreenRect);
if(nRet != SUCCESS)
return nRet;
/* The palette might have changed */
SendMessage (hWnd, WM_QUERYNEWPALETTE, 0, 0L);
/* Release the device context */
ReleaseDC (NULL, ScreenDC);
return SUCCESS;
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document