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.
#include "l_bitmap.h"
L_LTDIS_API L_INT L_CopyToClipboard(hWnd, pBitmap, uFlags)
Handle to the active window.
Pointer to the bitmap handle referencing the bitmap to be copied.
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.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
The clipboard will contain the same width, height, bits per pixel, and color order as the image in the bitmap.
Win32, x64.
This example loads a bitmap, copies only the DIB data to the clipboard, and deletes the original bitmap.
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("Image2.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;
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document