C#|Working with process help [closed]
a few days ago i started working with process, i did a few things.. and wanted to ask a question.
lets say i got a process :
process = Process.Start("D:\\Server1\\orangebox\\srcds.exe", "srcds.exe -console -game cstrike +maxplayers 16 -port 27017 +map de_dust2");
process.EnableRaisingEvents = true;
process.Exited += new EventHandler(process_Exited);
}
void process_Exited(object sender, EventArgs e)
{
process = Process.Start("D:\\Server1\\orangebox\\srcds.exe", "srcds.exe -console -game cstrike +maxplayers 16 -port 27017 +map de_dust2");
process.EnableRaisingEvents = true;
process.Exited += new EventHandler(process_Exited);
so, its works perfect. but, how can i do new process? but. added them from a button and the info of them comes from a textbox.
lets say i got button1
and 3 textbox
. 1 of the textboxs
give me the process name, 1 the args, and 1 if to run now ot not.
so how can i do that?
thanks!!
Use ProcessStartInfo class to specify an arguments and assign it to relative property of your Process class.
http://msdn.microsoft.com/en-us/library/system.diagnostics.processstartinfo(v=vs.71).aspx
If you don't want process run now, initialize it but don't call Run() NOW.
精彩评论