-
I'm making a .dll like cards.dll, and i want to save the pics for the cards in the dll. I'm using the resource editor, but it only wants to save bmp's as pictures. My cards are gif's. I can save them as custom resources, but when i read them, they are returned as a byte array. How can i 'transform' them to IPictureDisp?
-
Here you go, just pass in the location were you want the file saved, and the id number of the resource. It assumes that your resource is in 'custom', if it isn't you can add another parameter to this...
Code:
''To save a gif from the resource file
BuildResource("c:\temp\my gif.gif",101)
''This function will save any custom resource file on to your disk.
Public Function BuildResource(destFILE As String, resID As Integer) As String
On Error GoTo ErrorBuildFileFromResource
Dim resBYTE() As Byte
resBYTE = LoadResData(resID, "CUSTOM")
Open destFILE For Binary Access Write As #1
Put #1, , resBYTE
Close #1
Exit Function
ErrorBuildFileFromResource:
Exit Function
End Function
-
Thanks.
I would prefer not to save the data to a file. I just want to load it into a picture box.
-
Not sure if you can :(
Can't you get your app to dump the gifs somewere on the pc when it loads (i.e. in the temp folder) and then delete them when it closes ??