Added: Apr 29, 2002
Snippet uploaded by: snippet
Written By: unknown
Demo: Sorry, no demo
Highlight all by clicking in box
Private Type PicBmp
Size As Long
Type As Long
hBmp As Long
hPal As Long
Reserved As Long
Private Type GUID
Data1 As Long
Data2 As Integer
Data3 As Integer
Data4(7) As Byte
Private Declare Function OleCreatePictureIndirect Lib "olepro32.dll"
(PicDesc As PicBmp, RefIID As GUID, ByVal fPictureOwnsHandle As Long,
IPic As IPicture) As Long
Public Function CreatePictureFromHandle(Handle As Long, PictureType As
Long) As IPictureDisp
Dim Pic As PicBmp
' IPicture requires a reference to "Standard OLE Types"
Dim IPic As IPicture
Dim IID_IDispatch As GUID
' Fill in with IDispatch Interface ID
.Data1 = &H20400
.Data4(0) = &HC0
.Data4(7) = &H46
' Fill Pic with necessary parts
.Size = Len(Pic) ' Length of structure
.Type = PictureType ' Type of Picture
.hBmp = Handle ' Handle to bitmap
.hPal = 0 ' Handle to palette (may be null)
' Create Picture object
OleCreatePictureIndirect Pic, IID_IDispatch, 1, IPic
' Return the new Picture object
Set CreatePictureFromHandle = IPic
No Comments to show
Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.
Adding your comment. Please wait...
Thanks for adding your comment!. After further review it will be added.
There was a problem adding your comment. Please try again.
Please complete all the fields in the form before sending.