|
-
May 24th, 2009, 02:03 AM
#1
Thread Starter
Lively Member
Make .exe resource run while Form1_load[HELP]
How can i make it so that when i load my form, it loads a .exe file along with it that is in my Resource folder? Thanks
-
May 24th, 2009, 02:55 AM
#2
Thread Starter
Lively Member
Re: Make .exe resource run while Form1_load[HELP]
-
May 24th, 2009, 03:47 AM
#3
Re: Make .exe resource run while Form1_load[HELP]
I don't know of any clean way to do this. But this will work assuming you added the exe into your resources:
vb.net Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim tempFileName As String = System.IO.Path.GetTempFileName() & ".exe" Using fs As New FileStream(tempFileName, FileMode.Create) fs.Write(My.Resources.exeNameHere, 0, My.Resources.exeNameHere.Length) End Using Process.Start(tempFileName) End Sub
-
May 27th, 2009, 02:46 PM
#4
Thread Starter
Lively Member
Re: Make .exe resource run while Form1_load[HELP]
i get FileStream is not defined
-
May 27th, 2009, 02:51 PM
#5
Addicted Member
Re: Make .exe resource run while Form1_load[HELP]
For my current app, I added as a resource, the CHM help file, so that in case the copy distributed with the appilcation is lost, it can be re-written to disk. Here is the code that does that:
vb.net Code:
Dim Writer As New IO.FileStream(Application.StartupPath & "\filename.chm", IO.FileMode.Create) Writer.Write(My.Resources.RESOURCE-NAME-HERE, 0, My.Resources. RESOURCE-NAME-HERE.Length) Writer.Close()
Change the chm to exe and see what you get.
Edit: I see that my code is the same as ForumAccount's code. Try adding the Close function, though. In addition, I also have "Imports System.Deployment.Application" at the top of my code.
Last edited by JugglingReferee; May 27th, 2009 at 02:58 PM.
PC #1: Athlon64 X2+Vista64+VS2008EE+.NET3.5 #2: XP (all flavours Ghost'd)+VS2008EE+.NET3.5
Help Files: HelpMaker · Dr. Explain · Create Icons: IcoFX
"Whoever eats my flesh and drinks my blood has eternal life, and I will raise him on the last day." John 6:54
-
May 27th, 2009, 02:55 PM
#6
Thread Starter
Lively Member
Re: Make .exe resource run while Form1_load[HELP]
Ugh no luck its ok i changed my mind, thx for the help both of you ! =]
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
|