L_ScreenCaptureBitmap

#include "l_bitmap.h"

L_LTDIS_API L_INT L_ScreenCaptureBitmap(hDC, pBitmap, uStructSize, pRect)

L_HDC hDC;

handle to the source device

pBITMAPHANDLE pBitmap;

pointer to the target bitmap handle

L_UINT uStructSize;

size in bytes, of the structure pointed to by pBitmap

L_RECT* pRect;

portion of the device context to capture

Loads a bitmap from the specified rectangle within a device context.

Parameter

Description

hDC

Handle to the source device. The mapping mode of the device context must be MM_TEXT.

pBitmap

Pointer to the bitmap handle referencing the target bitmap.

uStructSize

Size in bytes, of the structure pointed to by pBitmap, for versioning. Use sizeof(BITMAPHANDLE).

pRect

The windows RECT structure that specifies the portion of the device context to capture.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

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 Screen Capture Help File (refer to Ltscrdllx.chm).

Required DLLs and Libraries

LTDIS

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

Platforms

Win32, x64.

See Also

Topics:

Raster Image Functions: Input and Output

Example

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 Version 20.0.2018.1.19
Products | Support | Contact Us | Copyright Notices
© 1991-2018 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Raster Imaging C API Help