L_CopyFromClipboard

#include "l_bitmap.h"

L_LTDIS_API L_BOOL L_CopyFromClipboard(hWnd, pBitmap, uStructSize)

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

Parameters

L_HWND hWnd

Handle to the active window.

pBITMAPHANDLE pBitmap

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

L_UINT uStructSize

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

Returns

Value Meaning
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

Platforms

Win32, x64.

See Also

Functions

Topics

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 20.0.2020.4.3
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help