Hi
I'm testing your ImageBox control & I like it, but I can't find how to save the image in the hard disk. eg. If I load an image from some URL, how can I save this image in my hard disk?
Private Declare Function OleCreatePictureIndirect Lib "olepro32.dll" ( _
lpPictDesc As PictDesc, _
riid As Guid, _
ByVal fPictureOwnsHandle As Long, _
ipic As IPicture _
) As Long
Private Type PictDesc
cbSizeofStruct As Long
picType As Long
hImage As Long
xExt As Long
yExt As Long
End Type
Private Type Guid
Data1 As Long
Data2 As Integer
Data3 As Integer
Data4(0 To 7) As Byte
End Type
Public Function BitmapToPicture(ByVal hBmp As Long) As IPicture
If (hBmp = 0) Then Exit Function
Dim NewPic As Picture, tPicConv As PictDesc, IGuid As Guid
' Fill PictDesc structure with necessary parts:
With tPicConv
.cbSizeofStruct = Len(tPicConv)
.picType = vbPicTypeBitmap
.hImage = hBmp
End With
' Fill in IDispatch Interface ID
With IGuid
.Data1 = &H20400
.Data4(0) = &HC0
.Data4(7) = &H46
End With
' Create a picture object:
OleCreatePictureIndirect tPicConv, IGuid, True, NewPic
' Return it:
Set BitmapToPicture = NewPic
End Function
Private Sub SaveToBitmap_Click()
Call SavePicture(BitmapToPicture(ImageBox1.GetHBitmap), "c:\test.bmp")
End SubReturn to GdImageBox [Pro] ActiveX
Users browsing this forum: No registered users and 1 guest