Available in LEADTOOLS Imaging Pro, Vector, Document, and Medical Imaging toolkits. |
#include "l_bitmap.h"
L_LTDIS_API L_INT L_CopyToClipboard(hWnd, pBitmap, uFlags)
L_HWND hWnd; |
/* handle to the active window */ |
pBITMAPHANDLE pBitmap; |
/* pointer to the bitmap handle */ |
L_UINT uFlags; |
/* indicates how image data is placed on the clipboard */ |
Copies the RGB or raster image data from a specified bitmap to the clipboard. With this extended function, you can control how image data is placed on the clipboard.
Parameter |
Description |
|
hWnd |
Handle to the active window. |
|
pBitmap |
Pointer to the bitmap handle referencing the bitmap to be copied. |
|
uFlags |
Indicates how image data is placed on the clipboard. You can use a bitwise OR ( | ) to pass more than one value. Valid values are: |
|
|
Value |
Meaning |
|
COPY2CB_EMPTY |
[0x0001] Empty the clipboard before copying data to it. |
|
COPY2CB_DIB |
[0x0002] Copy DIB data to the clipboard. |
|
COPY2CB_DDB |
[0x0004] Copy DDB data to the clipboard. |
|
COPY2CB_PALETTE |
[0x0008] Copy palette data to the clipboard. |
|
COPY2CB_RGN |
[0x0010] Copy the bitmap's region to the clipboard. |
|
If you specify all of the values it is the same as using the L_CopyToClipboard function. |
Returns
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
Comments
The clipboard will contain the same width, height, bits per pixel, and color order as the image in the bitmap.
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: |
|
|
|
Topics: |
Example
This example loads a bitmap, copies only the DIB data to the clipboard, and deletes the original bitmap.
#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName L_INT CopyToClipboardExample(L_HWND hWnd) { L_INT nRet; BITMAPHANDLE LeadBitmap; /* Bitmap handle for the image */ /* Load a bitmap, keeping its own bits per pixel */ nRet = L_LoadBitmap (MAKE_IMAGE_PATH(TEXT("ImageProcessingDemo\\Image3.cmp")), &LeadBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL); if(nRet != SUCCESS) return nRet; /* Copy the bitmap to the clipboard */ nRet = L_CopyToClipboard (hWnd, &LeadBitmap, COPY2CB_EMPTY | COPY2CB_DIB); if(nRet != SUCCESS) return nRet; /* Delete the original bitmap, leaving the copy in the clipboard */ L_FreeBitmap(&LeadBitmap); return SUCCESS; }