L_CopyToClipboard

#include "l_bitmap.h"

L_LTDIS_API L_INT L_CopyToClipboard(hWnd, pBitmap, uFlags)

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.

Parameters

L_HWND hWnd

Handle to the active window.

pBITMAPHANDLE pBitmap

Pointer to the bitmap handle referencing the bitmap to be copied.

L_UINT 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

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

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.

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; 
} 

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