Open a program from Resource
Posted: Mon Apr 12, 2010 3:24 pm
How can i open a program from Resource?
Sharing, Teaching and Supporting coders of all ages and levels since 2009
https://www.codenstuff.com/forum/
IO.File.WriteAllBytes("C:\NameOfFileToSaveAs.exe", My.Resources.NameOfApplicationResource)
Process.Start("C:\NameOfFileToSaveAs.exe")
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)