Open a program from Resource
Do you need something made? then ask in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
3 posts
Page 1 of 1
The best way ( as said by CodenStuff" ) is to extract the EXE and then run it
I haven't seen a program being launch from inside another program.
anyways, here's how you extract it from your program and then run it
I haven't seen a program being launch from inside another program.
anyways, here's how you extract it from your program and then run it
Code: Select all
You can thank CodenStuff for that code!IO.File.WriteAllBytes("C:\NameOfFileToSaveAs.exe", My.Resources.NameOfApplicationResource)
Process.Start("C:\NameOfFileToSaveAs.exe")
You can run .Net functions from an exe/dll resource file, though running non-.net programs is a bit harder.
Code: Select all
Dim cur As Assembly = Assembly.GetAssembly(GetType(Module1))
Dim s As Stream = cur.GetManifestResourceStream("ConsoleApplication1.test.exe")
If s Is Nothing Then
MsgBox("can't find your exe in embedded resources.")
Return
End If
Dim ProgBytes(s.Length) As Byte
s.Read(ProgBytes, 0, ProgBytes.Length)
s.Close()
Dim nxt As Assembly = Assembly.Load(ProgBytes)
Dim method As MethodInfo = nxt.EntryPoint
Dim inst As Object = nxt.CreateInstance(method.Name)
method.Invoke(inst, Nothing)
3 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023