![]() ![]() ![]() 'hBmpOrig = apiSelectObject(hDCtemp, hBmptemp) ' We need to create a regular bitmap from our CreateDibSectionĭim IPic As IPicture, picdes As PictDesc, iidIPicture As IID ' that get's passed to OleCreatePictureIndirect. ' cannot be passed directly as the PICTDESC.Bitmap element ' The handle to the Bitmap created by CreateDibSection ' Bruce McKinney's "Hardcore Visual Basic" Public Function BitmapToPicture(ByVal hBmp As Long, _ 'Please report any bugs to my email address. 'No serious bugs notices at this point in time. 'code to allow any depth bitmaps and add support for 'To keep it simple this version only works with Bitmap files of ' This must be a 24 bit bitmap for this release. ' This version only handles BITMAP files. ' Bound or Unbound OLE Control to a Disk file. 'Purpose: Provides a method to save the contents of a ' if you use this function in your own code. ' Please include the one line Copyright notice ' own application without cost or obligation. ' free to use any/all of this code within your 'DEVELOPED AND TESTED UNDER MICROSOFT ACCESS 97 VBA ONLY 'The API format types we're interested in 'Create our own copy of the bitmap, so it doesn't get wiped out byĭeclare Function CopyImage Lib "user32" (ByVal handle As Long, ByVal un1Īs Long, ByVal n1 As Long, ByVal n2 As Long, ByVal un2 As Long) As Long (ByVal hemfSrc As Long, ByVal lpszFile As String) As Long 'Create our own copy of the metafile, so it doesn't get wiped out byĭeclare Function CopyEnhMetaFile Lib "gdi32" Alias "CopyEnhMetaFileA" Private Declare Function CloseClipboard Lib "user32" () As Long Private Declare Function GetClipboardData Lib "user32" (ByVal wFormat As Private Declare Function OpenClipboard Lib "user32" (ByVal hwnd As Long) Private Declare Function IsClipboardFormatAvailable Lib "user32" (ByVal 'Does the clipboard contain a bitmap/metafile? Private Declare Function OleCreatePictureIndirect Lib _ Private Declare Function apiDeleteObject Lib "gdi32" _Īlias "DeleteObject" (ByVal hObject As Long) As Long ![]()
0 Comments
Leave a Reply. |