Posted on 2011-09-18
I'm using the followin code to load a bitmap to a picture control and then trying to copy the image to the clipboard:
Private Declare Function OpenClipboard Lib "USER32" (ByVal hWnd As Long) As Long
Private Declare Function CloseClipboard Lib "USER32" () As Long
Private Declare Function SetClipboardData Lib "USER32" (ByVal wFormat As Long, ByVal hMem As Long) As Long
Private Declare Function EmptyClipboard Lib "USER32" () As Long
Private Const CF_BITMAP = 2
Public Function SavePicBit(str21 As String, pPic As Object, boundFrame As BoundObjectFrame, frm As Form, estNo As Long, PicRef As Long)
pPic.Visible = True
pPic.Picture = str21
SetClipboardData pPic.Image & vbNullChar, CF_BITMAP
I'm able to see the correct image appear on the control pPic, but the SetClipboardData is not saving the image to the clipboard.
Any sugestions on what is missing??