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?
Printable View
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?
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 :)
Sure! Here is a function I wrote for a similar post:
Usage: RunResourceExe ResourceIDCode: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
Example: RunResourceExe 101
Assuming that you have an ID 101 in the CUSTOM thread.
------------------
Serge
Software Developer
[email protected]
[email protected]
ICQ#: 51055819
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.