I gues xbox.exe is not written in managed code, so the only way to run it from your app is to embed it first and at runtime you'll copy from the resource to Windows TMP and run it from there.. then you delete it...
As suggested by some other user, you need to copy that embedded resource to a temporary location (Windows Temp for eg). To create a file out of the embedded resource, you will use System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream (<the name of the exe resource). This gives you a System.IO.Stream object tha you read and write the content to a System.IO.FileStream object.
I gues xbox.exe is not written in managed code, so the only way to run it from your app is to embed it first and at runtime you'll copy from the resource to Windows TMP and run it from there.. then you delete it...
Do you have any tutorials on this or can you contact me on msn to help me if you have time . THANKS ALOT
i was reading up on it and i seen how to open a pic from the embedded resources but i cant seem to find anything on how to execute a .exe file that is a embedded resource
Executing Exe
Magnus Lovsten
umahesh2k1
Romano.Scuri
As suggested by some other user, you need to copy that embedded resource to a temporary location (Windows Temp for eg). To create a file out of the embedded resource, you will use System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream (<the name of the exe resource). This gives you a System.IO.Stream object tha you read and write the content to a System.IO.FileStream object.
Rid
Do you have any tutorials on this or can you contact me on msn to help me if you have time . THANKS ALOT
Phillip Knezevich
ASMK
System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo.FileName = "Full Path to EXE";
process.Start();
John_Cronan
Here it is:
public static void RunEmbededExe(string exeName) { int read = 0; byte[] buffer = new byte[2048]; Assembly asm = Assembly.GetExecutingAssembly(); using (Stream stream = asm.GetManifestResourceStream(asm.GetName().Name + "." + exeName)) { using (FileStream fs = new FileStream(Application.StartupPath + "\\" + exeName, FileMode.Create, FileAccess.Write)) { using (BinaryWriter bw = new BinaryWriter(fs)) { while ((read = stream.Read(buffer, 0, buffer.Length)) > 0) { bw.Write(buffer, 0, read); bw.Flush(); } } } } buffer = null; const int ERROR_FILE_NOT_FOUND = 2; const int ERROR_ACCESS_DENIED = 5; Process proc = new Process(); try { proc.StartInfo.FileName = Application.StartupPath + "\\" + exeName; proc.StartInfo.CreateNoWindow = false; proc.Start(); proc.WaitForExit(); } catch (Win32Exception ex) { if (ex.NativeErrorCode == ERROR_FILE_NOT_FOUND) { MessageBox.Show(ex.Message + ". Check the path."); } else if (ex.NativeErrorCode == ERROR_ACCESS_DENIED) { MessageBox.Show(ex.Message + ".\n You do not have permission to run this file."); } } }stilts
David Winningham
You call it like this:
RunEmbededExe("unpackedXBOXv2.exe");
Pandurang Nayak
using System.Diagnostics;
Process proc = new Process();
proc.StartInfo.FileName = "app.exe";
proc.Start();
For more details search the MSDN for Process class.
JPATEL
rdmorgan
SQLChamp
Giddyup_rr
When you put app.exe i put the filename of the app in the solution explorer but i get a error that says system cant find the file.
look here: http://yourserversolution.com/pro.JPG