Yeah, I think so. I have a similar situation, where I download JPG images
from the web, and have them stored in byte arrays. Not sure if that (a byte
array that holds the file image of a JPG) is exactly what you got, though?
If so, you'll need to dig up a copy of Edanmo's OLELIB typelib, and then use
code like this...
' ********************************************************************
' This function was taken from Edanmo's site:
' http://www.mvps.org/emorcillo/vb6/multimedia/picturefromarray.shtml
' and requires a reference to OLELIB.TLB to work
' --------------------------------------------------------------------
' Load a picture from a byte array
' If you want to load a picture (other than BMP) from a resource or
' a database without saving it to disk you can use this function.
' The function loads the array in a memory stream and then uses the
' IPersistStream of the StdPicture object to loads the image from
' the stream.
' Example:
' Me.Picture = LoadImage(LoadResData(101, "Custom"))
' ********************************************************************
Private Function LoadImage(ImageBytes() As Byte) As StdPicture
Dim oPersist As IPersistStream
Dim oStream As IStream
Dim lSize As Long
' Calculate the array size
lSize = UBound(ImageBytes) - LBound(ImageBytes) + 1
' Create a stream object
' in global memory
Set oStream = CreateStreamOnHGlobal(0, True)
' Write the header to the stream
oStream.Write &H746C&, 4&
' Write the array size
oStream.Write lSize, 4&
' Write the image data
oStream.Write ImageBytes(LBound(ImageBytes)), lSize
' Move the stream position to
' the start of the stream
oStream.Seek 0, STREAM_SEEK_SET
' Create a new empty picture object
Set LoadImage = New StdPicture
' Get the IPersistStream interface
' of the picture object
Set oPersist = LoadImage
' Load the picture from the stream
oPersist.Load oStream
' Release the streamobject
Set oStream = Nothing
End Function
' ********************************************************************
Later... Karl
--
Working without a .NET?
http://classicvb.org/