L_ScreenCaptureBitmap

#include "l_bitmap.h"

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

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 */

LPRECT 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

Windows 95 / 98 / Me, Windows 2000 / XP.

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 */

BITMAPHANDLE LeadBitmap;   /* Bitmap handle for the captured image */

void TestFunction(HWND hWnd)
{
   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 */
   L_ScreenCaptureBitmap (ScreenDC, &LeadBitmap, sizeof(BITMAPHANDLE), &ScreenRect);
   /* The palette might have changed */
   SendMessage (hWnd, WM_QUERYNEWPALETTE, 0, 0L);

   /* Release the device context */
   ReleaseDC (NULL, ScreenDC);

   return;
}