'Create our own copy of the bitmap, so it doesn't get wiped out by subsequent clipboard updates.ĭeclare PtrSafe Function CopyImage Lib "user32" (ByVal Handle As LongPtr, ByVal un1 As Long, ByVal n1 As Long, ByVal n2 As Long, ByVal un2 As Long) As LongPtr 'Create our own copy of the metafile, so it doesn't get wiped out by subsequent clipboard updates.ĭeclare PtrSafe Function CopyEnhMetaFile Lib "gdi32" Alias "CopyEnhMetaFileA" (ByVal hemfSrc As LongPtr, ByVal lpszFile As String) As LongPtr Private Declare PtrSafe Function OleCreatePictureIndirect Lib "oleaut32.dll" (PicDesc As uPicDesc, RefIID As GUID, ByVal fPictureOwnsHandle As LongPtr, IPic As IPicture) As Long 'Convert the handle into an OLE IPicture interface. Private Declare PtrSafe Function CloseClipboard Lib "user32" () As Long Private Declare PtrSafe Function GetClipboardData Lib "user32" (ByVal wFormat As Integer) As LongPtr Private Declare PtrSafe Function OpenClipboard Lib "user32" (ByVal hWnd As LongPtr) As Long Private Declare PtrSafe Function IsClipboardFormatAvailable Lib "user32" (ByVal wFormat As Integer) As Long 'Does the clipboard contain a bitmap/metafile? 'Declare a UDT to store a GUID for the IPicture OLE Interface '* fnOLEError Get the error text for an OLE error code '* CreatePicture Private function to convert a bitmap or metafile handle to an OLE reference '* PastePicture The entry point for the routine '* to paste a picture of whatever is on the clipboard into a standard image control. '* Set Image1.Picture = PastePicture(xlPicture) '* The code in this module has been derived from a number of sources '* The code requires a reference to the "OLE Automation" type library '* the picture type - xlBitmap or xlPicture. The PastePicture function takes an optional argument of '* This object can then be assigned to (for example) and Image control '* DESCRIPTION: Creates a standard Picture object from whatever is on the clipboard. '* AUTHOR & DATE: STEPHEN BULLEN, Office Automation Ltd
0 Comments
Leave a Reply. |