PDA

Click to See Complete Forum and Search --> : Toubles accessing resource file


VB Starter
Dec 7th, 1999, 06:28 AM
ok, i am trying to run a .exe from a resource file, here's my script:
_____________________________________________
Public Sub PlayElfBowl(id101 As Integer)
Dim bytResdata() As Byte
Dim intFreefile() As Integer
Dim strTemp() As String
bytResDate = LoadResData(id101, "Custom")
strTemp = App.Path & IIf(Right(App.Path, 1) = "\", "temp.exe", "\temp.exe")

intFreefile = FreeFile
Open strTemp For Binary As intFreefile
Put #intFreefile, , bytResdata
Close #intFreefile
Call PlayElfBowl(strTemp, Flags)
Kill strTemp
End Sub

Private Sub Command1_Click()
Call PlayElfBowl
End Sub
_____________________________________________
i knew this was wrong anyway, but i dont know what is wrong, can anyone help?

Shadowlord
Mar 7th, 2000, 12:33 AM
1. In your PlayElfBowl sub, near the end, you have a line that reads "Call PlayElfBowl". VB generates an error if you call a sub within itself, as the loop you start will never end.

2. Check your code for reading from the RES file. Use the examples here:
http://www.vb-world.net/ubb/Forum1/HTML/011328.html

3. You might have an error in your code for writing files. I don't know file code very well, but check the examples on this site against your own code.

4. If this is a Copy/Paste of your actual code, you spelled
"bytResData" wrong on the LoadResData line.

5. You need to pass a constant (in this case 10, I think) instead of using "Custom" when calling LoadResData.

Hope this helps,
Shadowlord spinwardsoftware@hotmail.com