[Gtk-sharp-list] spawning apps
Duncan Mak
duncan@ximian.com
19 Sep 2002 10:26:17 -0400
--=-mSrkGkn11yu6tX7xicH4
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
On Thu, 2002-09-19 at 11:27, Glenn Pierce wrote:
> That does not work for me the program just returns.
> I have also tried.
I know Process works because I tried the MS sample and it worked for me.
Here's the sample from MS.
--
Duncan Mak <duncan@ximian.com>
--=-mSrkGkn11yu6tX7xicH4
Content-Disposition: attachment; filename=ProcessDemo.cs
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; name=ProcessDemo.cs; charset=ISO-8859-1
using System;
using System.Diagnostics;
using System.Threading;
public class ProcessDemo
{
public static void Main(String[] args)=20
{
string appName =3D Environment.GetCommandLineArgs()[0];
=20
if(args.Length !=3D 1)
{
Console.WriteLine("Usage: " + appName +" <executable>");
return;
}
string executableFilename =3D args[0];
=20
Process process =3D new Process();
process.StartInfo.FileName =3D executableFilename;
process.Start();
=20
process.WaitForInputIdle();
=20
Thread.Sleep(1000);
if(!process.CloseMainWindow())
{
process.Kill();
}
}
}
--=-mSrkGkn11yu6tX7xicH4--