|
-
Sep 13th, 2000, 06:45 AM
#1
Thread Starter
Hyperactive Member
Hi,
Is it possible to load .jpg files into a resource file and then take them into an image control?
I managed to place then into a resource file. but how do I read them from there?? Tried using the LoadResData function, but I get an error
"Resource with identifier 101 not found"
I've stored the .jpg files in rhe resource file as "custom resource" and the id is 101.
any ideas???
Thanx.
-
Sep 13th, 2000, 07:29 AM
#2
The exact syntax should be:
Code:
LoadResData(101, "CUSTOM")
-
Sep 13th, 2000, 07:32 AM
#3
Thread Starter
Hyperactive Member
but how do I store the jpeg files in the resource editor in the first place??
-
Sep 13th, 2000, 09:42 AM
#4
-
Sep 13th, 2000, 12:58 PM
#5
Thread Starter
Hyperactive Member
If I want to set the picture property of an image control to a jpeg file from the resource file, what am I to do?
tried
Image1.Picture = LoadResPicture(101, "CUSTOM")
but that didn't work.
what am I doing wrong???
Thanx
-
Sep 13th, 2000, 05:19 PM
#6
You can use this function I wrote a while back:
Code:
Public Function GetPictureFromResource(p_lngResourceID As Integer) As IPictureDisp
Dim bytArr() As Byte
Dim intFFN As Integer
Dim strPath As String
bytArr = LoadResData(p_lngResourceID, "CUSTOM")
strPath = App.Path & IIf(Right(App.Path, 1) = "\", "MyPicture.tmp", "\MyPicture.tmp")
intFFN = FreeFile
Open strPath For Binary As intFFN
Put #intFFN, , bytArr
Close #intFFN
Set GetPictureFromResource = LoadPicture(strPath)
Kill strPath
End Function
Now you can use this function like this:
Code:
Private Sub Command2_Click()
Image1.Picture = GetPictureFromResource(101)
End Sub
-
Sep 13th, 2000, 11:25 PM
#7
Thread Starter
Hyperactive Member
thanx Serge, that worked! )
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|