Private Declare Function CreateStreamOnHGlobal Lib "ole32.dll" ( _
ByVal hGlobal As Long, _
ByVal fDeleteOnRelease As Long, _
lpIStream As IUnknown) As Long
Private Declare Function OleLoadPicture Lib "oleaut32.dll" ( _
ByVal lpStream As IUnknown, _
ByVal lSize As Long, _
ByVal fRunmode As Long, _
riid As Any, _
lpIPicture As IPicture) As Long
Function ByteToPict(PictureData() As Byte) As StdPicture 'Byte转图片
Dim IID_IPicture(3) As Long
Dim oPicture As IPicture
Dim nResult As Long
Dim oStream As IUnknown
Dim hGlobal As Long
IID_IPicture(0) = &H7BF80980
IID_IPicture(1) = &H101ABF32
IID_IPicture(2) = &HAA00BB8B
IID_IPicture(3) = &HAB0C3000
Call CreateStreamOnHGlobal(VarPtr(PictureData(LBound(PictureData))), 0, oStream)
nResult = OleLoadPicture(oStream, 0, 0, IID_IPicture(0), oPicture)
If nResult = 0 Then
Set ByteToPict = oPicture
End If
End Function
先把byte转为StdPicture再进行SavePicture