Not a Member Yet,
Click here to Register
How do you like the new design?






ID: 158
Viewed: 2524
Added: Apr 29, 2002
Version:
Snippet uploaded by: snippet
Written By: unknown
Demo: Sorry, no demo



User Rated at: 0 Stars
Rate This:

Thank you for your vote. Please wait...

It appears you already voted for this snippet

It appears your vote value was empty

none

Highlight all by clicking in box
<!---Declaration--->
Private Type PicBmp
Size As Long
Type As Long
hBmp As Long
hPal As Long
Reserved As Long
End Type

Private Type GUID
Data1 As Long
Data2 As Integer
Data3 As Integer
Data4(7) As Byte
End Type

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
With IID_IDispatch
.Data1 = &H20400
.Data4(0) = &HC0
.Data4(7) = &H46
End With

' Fill Pic with necessary parts
With Pic
.Size = Len(Pic) ' Length of structure
.Type = PictureType ' Type of Picture
.hBmp = Handle ' Handle to bitmap
.hPal = 0 ' Handle to palette (may be null)
End With

' Create Picture object
OleCreatePictureIndirect Pic, IID_IDispatch, 1, IPic

' Return the new Picture object
Set CreatePictureFromHandle = IPic

End Function

Highlight All
<!---Code--->
none;


No Comments to show

Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.


Replying to a Comment...


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.

© 2002 - 2017 snippetlibrary.com All Rights Reserved. Conditions