[HELP] .exe From Resource[Solved]

Posts 114 of 14 · Page 1 of 1
[HELP] .exe From Resource[Solved]
Can i open a program .exe from my resources??

Like button1_click :

My.Resources.program

Some thing like that..If i can, please tell me how..
bud check the snippits vault next time but here_

Imports System.IO


Now this in a button click (or whet ever triggers the event)


Dim RPath As String = Application.StartupPath & "\File.exe" 'File.exe will be a temp name given to your exe, you can make it anything you want, or keep it as is.

' Will create the file with the given name
Using CreateFile As New FileStream(RPath, FileMode.Create)
CreateFile.Write(My.Resources.YourResource, 0, My.Resources.YourResource.Length)
End Using
' Start the application
Process.Start(RPath)


Note: "Your Resource" in my code example above needs to be the EXE name without the exe extension, so for example, if you add notepad.exe as a resource, then the code would be


Dim RPath As String = Application.StartupPath & "\File.exe"

Using CreateFile As New FileStream(RPath, FileMode.Create)
CreateFile.Write(My.Resources.Notepad, 0, My.Resources.Notepad.Length)
End Using

Process.Start(RPath)
Quote Originally Posted by Qizzle15401 View Post
bud check the snippits vault next time but here_

Imports System.IO


Now this in a button click (or whet ever triggers the event)


Dim RPath As String = Application.StartupPath & "\File.exe" 'File.exe will be a temp name given to your exe, you can make it anything you want, or keep it as is.

' Will create the file with the given name
Using CreateFile As New FileStream(RPath, FileMode.Create)
CreateFile.Write(My.Resources.YourResource, 0, My.Resources.YourResource.Length)
End Using
' Start the application
Process.Start(RPath)


Note: "Your Resource" in my code example above needs to be the EXE name without the exe extension, so for example, if you add notepad.exe as a resource, then the code would be


Dim RPath As String = Application.StartupPath & "\File.exe"

Using CreateFile As New FileStream(RPath, FileMode.Create)
CreateFile.Write(My.Resources.Notepad, 0, My.Resources.Notepad.Length)
End Using

Process.Start(RPath)
Or simply:

Code:
Dim RPath As String = Application.StartupPath & "\File.exe" 
IO.File.WriteAllBytes(RPath, My.Resources.ResourceNameHere)
Quote Originally Posted by Jason View Post


Or simply:

Code:
Dim RPath As String = Application.StartupPath & "\File.exe" 
IO.File.WriteAllBytes(RPath, My.Resources.ResourceNameHere)
You're the best , just 2 lines

But one question in the \File.Exe , I put the Resource or what?

EDIT: Im gonna sleep, Just say what i need to put in \File.Exe and This /SOLVED
And Thanks..
jason lol i was just trying to show the guy the information is already here and he doesnt always have to ask ?'s
add a process from toolbox
make it's property filename to the file you want
on button1 click event
process1.start
Thank you all, But it wont open
Quote Originally Posted by Lyoto Machida View Post
Thank you all, But it wont open
did u try what i told you??
Quote Originally Posted by T0P-CENT View Post
did u try what i told you??
I tryied to do that..But in the process properties dont have any filename!
I have vb 10
Quote Originally Posted by Lyoto Machida View Post
I tryied to do that..But in the process properties dont have any filename!
I have vb 10
yes it is in startinfo sub
Quote Originally Posted by T0P-CENT View Post
yes it is in startinfo sub
Thank you, That worked fine!
Thanks for the ss 2 =)

/Request Close
/SOLVED
Post your code please.
Quote Originally Posted by Blubb1337 View Post
Post your code please.
it isn't a code
he just add a process from toolbox

click on startinfo in properties
click on filename to browse one
then one button1 click event
Code:
process1.start
Thought Jasons code did not work...
Posts 114 of 14 · Page 1 of 1
This thread is closed for replies.

Tags for this Thread

None

Need help?