L_CopyFromClipboard

#include "l_bitmap.h"

L_LTDIS_API L_BOOL L_CopyFromClipboard(hWnd, pBitmap, uStructSize)

L_HWND hWnd;

handle to the active window

pBITMAPHANDLE pBitmap;

pointer to the bitmap handle

L_UINT uStructSize;

size in bytes, of the structure pointed to by pBitmap

Copies image data from the clipboard to a specified bitmap. The image on the clipboard must be a DIB, DDB, or aWMF.

Parameter

Description

hWnd

Handle to the active window.

pBitmap

Pointer to the bitmap handle referencing the bitmap to fill. This function will allocate the storage to hold the image.

uStructSize

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

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

The LEAD bitmap is referenced by the pointer to the bitmap handle. The bitmap will contain the same width, height, and bits per pixel as the image contained in the clipboard. The color order field in the bitmap handle will be set to ORDER_BGR. If the copied image is not in BGR order, it is up to you to change its color order using L_ColorResBitmap.

The destination bitmap must not be allocated before this function is called. If the bitmap is already allocated, you must free it and initialize the bitmap handle.

To determine whether a region was pasted, you must call L_BitmapHasRgn(pBitmap).

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

Functions:

L_ClipboardReady, L_CopyToClipboard,

 

L_CopyToClipboard

Topics:

Using DIBs, DDBs, and the Clipboard

Example

For complete sample code, refer to the FRAME.C module of the DEMO example. This example loads a bitmap using clipboard data, if available.

L_BOOL CopyFromClipboardExample(L_HWND hWnd,pBITMAPHANDLE   pLeadBitmap,L_INT *pRet) 
{ 
   if (L_ClipboardReady ()) 
   { 
      /* Copy the bitmap from the clipboard */ 
      if(pLeadBitmap->Flags.Allocated) 
         L_FreeBitmap(pLeadBitmap); 
      *pRet = L_CopyFromClipboard(hWnd, pLeadBitmap, sizeof(BITMAPHANDLE)); 
      return(TRUE); 
   } 
   else 
   { 
      return(FALSE); 
   } 
} 

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Raster Imaging C API Help