PDA

Click to See Complete Forum and Search --> : Desperate need of help with resource files


VB Starter
Dec 10th, 1999, 10:53 AM
I simply cant get to open a simple .exe or .txt file from a resource file, i tried, but i seem to be way off, can anybody give me a little help here?

Dec 10th, 1999, 02:10 PM
Are you trying to open a txt file as text into a text box? Are you trying to run the exe file? What is the resource file? Sorry for all the questions, I may not have any idea of what you are looking for but I can't help if I don't understand :)

Serge
Dec 10th, 1999, 08:18 PM
Sure! Here is a function I wrote for a similar post:

Public Sub RunResourceExe(pintResourceID As Integer)
Dim bytArr() As Byte
Dim intFFN As Integer
Dim strPath As String

bytArr = LoadResData(pintResourceID, "CUSTOM")
strPath = App.Path & IIf(Right(App.Path, 1) = "\", "~tempexe.exe", "\~tempexe.exe")
intFFN = FreeFile
Open strPath For Binary As intFFN
Put #intFFN, , bytArr
Close #intFFN
Shell strPath, vbNormalFocus
End Sub


Usage: RunResourceExe ResourceID
Example: RunResourceExe 101

Assuming that you have an ID 101 in the CUSTOM thread.

------------------

Serge

Software Developer
Serge_Dymkov@vertexinc.com
Access8484@aol.com
ICQ#: 51055819 (http://www.icq.com/51055819)

VB Starter
Dec 11th, 1999, 07:45 AM
the code works to run the .exe, but i cant get it to load a text. I was also hoping you could make some sense to the code since i know just a little about what it means. Thanks.