Available in LEADTOOLS Imaging Pro, Vector, Document, and Medical Imaging toolkits. |
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
Windows 2000 / XP/Vista, Windows CE.
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); } }