Hello, I use gifs on my projects, is it possible to save them to a resource file? I added one like a custom resource but know I dont know how to read it.
Thanks,
Chicho
Printable View
Hello, I use gifs on my projects, is it possible to save them to a resource file? I added one like a custom resource but know I dont know how to read it.
Thanks,
Chicho
Use LoadResPicture
Code:LoadResPicture 1000, vbResBitmap
Ive tried -> LoadResPicture(104,vbresbitmap) but it tells me that the Resource is not found, this is probably because I added it as a custom resource, and I Cannot added as a bitmap unless I change the file extension. Do I have to change it?
Thanks,
Chicho
If you use Custom resource, then you would need a byte array to get the resource:
Then call this function like this:Code:Public Sub RunPictureFromResource(pintResourceID As Integer, pPictureBox As PictureBox)
Dim bytArr() As Byte
Dim intFFN As Integer
Dim strPath As String
bytArr = LoadResData(pintResourceID, "CUSTOM")
strPath = App.Path & IIf(Right(App.Path, 1) = "\", MyPicture.gif", "\MyPicture.gif")
intFFN = FreeFile
Open strPath For Binary As intFFN
Put #intFFN, , bytArr
Close #intFFN
pPictureBox = LoadPicture(strPath)
Kill strPath
End Sub
Call RunPictureFromResource(101, Picture1)
Where
101 - is a resource ID
Picture1 - is a name of the PictureBox
Here is an example on adding pictures or html files into a RES File using the Webbrowser Control.
How to use the RES Protocol of the Webbrowser Control or how to use a HTML Files in Resources.
I never looked at it yet, but it might be what you are looking for.