[Mono-list] g_spawn_command_line_async

Aaron Bockover aaron.lists@aaronbock.net
Tue, 22 Mar 2005 00:33:11 -0500


I'm not familiar with Windows, but I'm guessing that %ProgramFiles% is
an environment variable, and it is probably not set when you make the
call. It probably works on the command line in windows, because when you
run the terminal, it probably sets that variable.

When I was doing some process control in C under GLib on Linux, I
remember reading that environment variables were not set, or there was
something specific you had to do.

See:
http://developer.gnome.org/doc/API/2.0/glib/glib-Spawning-Processes.html#g-spawn-async-with-pipes

--Aaron


On Mon, 2005-03-21 at 22:39 +0000, Phillip Neumann wrote:
> Hello.
> 
> 
> Im trying to start a new proces in the background with:
> 
>     g_spawn_command_line_async("command", IntPtr.Zero);
> 
> 
> it works fine on this unix mashine, but im trying the same on windows 
> and it has no effect...
> i have this:
> 
> 
>     [DllImport("libglib-2.0-0.dll")]
>     static extern bool g_spawn_command_line_async (string command, 
> IntPtr err);
>     public void RealPlayerStart(){
>         if (((int) System.Environment.OSVersion.Platform) >= 4){
>             //UNIX
>             g_spawn_command_line_async ("mpg123 
> http://sofsis.cl:8000/128.mp3", IntPtr.Zero);   
>         }
>         else{ //Windows
>             string s = "\"%ProgramFiles%\\Windows Media 
> Player\\wmplayer.exe\" http://sofsis.cl:8000/128.mp3";
>             Console.WriteLine("win32> "+s);
>             g_spawn_command_line_async (s, IntPtr.Zero);   
>         }
>     }
> 
> 
> on windows i get this output:
> 
>     win32>  %ProgramFiles%\Windows Media Player\wmplayer.exe" 
> http://sofsis.cl:8000/128.mp3
> 
> 
> witch looks fine, thinking that when i execute that on the msdos prompt 
> it works.. i.e. open the mediaplayer
> 
> 
> 
> 
> 
> whats the matter?
> 
> is this just not implemented on windows glib?
> 
> 
> 
> PD: im using mono 1.1.4 + gtk# installer
> 
> 
> 
> 
> thanks in advance!
> 
> 
> 
> 
> 
> 
> 
> _______________________________________________
> Mono-list maillist  -  Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
> 
>