[Mono-list] Process in Mono different from .Net

Jacek Rużyczka stacheldraht at interia.pl
Sun Dec 19 06:36:54 EST 2010


Am Sonntag 19 Dezember 2010, 06:37:48 schrieb madrang:
> Hi,
> 
> in windows this will leave Vlc open but under mono in linux Vlc will close
> with the Program.
> How can i force Linux to respect the windows behavior.
> 
> [code]
> using System.Diagnostics;
> using System.Threading;
> 
> class Program
> {
>     static void Main(string[] args)
>     {
>         Process.Start("vlc");
>         Thread.Sleep(1000);
>     }
> }
> [/code]
> 
Try this out:

Process pgpProcess = new Process();
pgpProcess.StartInfo = new ProcessStartInfo("your_executable", 
"your_parameters");
pgpProcess.StartInfo.WorkingDirectory = "/your/working/directory/";
pgpProcess.StartInfo.CreateNoWindow = true;
pgpProcess.EnableRaisingEvents = true;
pgpProcess.Exited += new EventHandler(this.OnPGPProcessExited);
pgpProcess.Start();

To get a wink once your process has completed, use a method like this:

protected void OnPGPProcessExited (object sender, EventArgs args)
{
	/* do something */
}

Kind regards
Jacek Rużyczka

----------------------------------------------------------------------
KONKURS! Wybierz nagrode roku i wygraj!
Sprawdz >> http://linkint.pl/f28a0



More information about the Mono-list mailing list