[Gtk-sharp-list] spawning apps
Glenn Pierce
glennpierce@connectfree.co.uk
19 Sep 2002 15:39:35 +0000
--=-3aExdkou4Tv+ZoD4SlTR
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
No luck with the MS sample
I am using a snapshot from sept 17th
I'll try to get mono from cvs and try that.
Thanks
On Thu, 2002-09-19 at 14:26, Duncan Mak wrote:
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>
____________________________________________________________________
using System;
using System.Diagnostics;
using System.Threading;
public class ProcessDemo
{
public static void Main(String[] args)
{
string appName = Environment.GetCommandLineArgs()[0];
if(args.Length != 1)
{
Console.WriteLine("Usage: " + appName +" <executable>");
return;
}
string executableFilename = args[0];
Process process = new Process();
process.StartInfo.FileName = executableFilename;
process.Start();
process.WaitForInputIdle();
Thread.Sleep(1000);
if(!process.CloseMainWindow())
{
process.Kill();
}
}
}
_____________________________
--=-3aExdkou4Tv+ZoD4SlTR
Content-Type: text/html; charset=utf-8
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/1.0.4">
</HEAD>
<BODY>
No luck with the MS sample
<BR>
<BR>
I am using a snapshot from sept 17th
<BR>
<BR>
I'll try to get mono from cvs and try that.
<BR>
<BR>
Thanks
<BR>
<BR>
<BR>
On Thu, 2002-09-19 at 14:26, Duncan Mak wrote:
<BLOCKQUOTE>
<PRE><FONT COLOR="#737373"><FONT SIZE="3"><I>On Thu, 2002-09-19 at 11:27, Glenn Pierce wrote:</FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I>> That does not work for me the program just returns. </FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I>> I have also tried. </FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I></FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I>I know Process works because I tried the MS sample and it worked for me.</FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I></FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I>Here's the sample from MS.</FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I></FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I>-- </FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I>Duncan Mak <duncan@ximian.com></FONT></FONT></I></PRE>
<HR>
<BR>
<FONT COLOR="#737373"><FONT SIZE="3"><I></FONT></FONT></I>
<PRE><FONT COLOR="#737373"><FONT SIZE="3"><I>using System;</FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I>using System.Diagnostics;</FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I>using System.Threading;</FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I></FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I>public class ProcessDemo</FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I>{</FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I> public static void Main(String[] args) </FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I> {</FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I> string appName = Environment.GetCommandLineArgs()[0];</FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I> </FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I> if(args.Length != 1)</FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I> {</FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I> Console.WriteLine("Usage: " + appName +" <executable>");</FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I> return;</FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I> }</FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I> string executableFilename = args[0];</FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I> </FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I> Process process = new Process();</FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I> process.StartInfo.FileName = executableFilename;</FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I> process.Start();</FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I> </FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I> process.WaitForInputIdle();</FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I> </FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I> Thread.Sleep(1000);</FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I> if(!process.CloseMainWindow())</FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I> {</FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I> process.Kill();</FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I> }</FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I> }</FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I>}</FONT></FONT></I>
<FONT COLOR="#737373"><FONT SIZE="3"><I></FONT></FONT></I></PRE>
</BLOCKQUOTE>
<TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>
<A HREF="mailto:glennpierce@connectree.co.uk"><FONT COLOR="#808080"><FONT SIZE="2"></FONT></FONT></A>
<BR>
<FONT COLOR="#6c51e8">_____________________________</FONT>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>
--=-3aExdkou4Tv+ZoD4SlTR--