Re: Console screen from spawn_process
- From: "Paulo Flabiano Smorigo" <pfsmorigo gmail com>
- To: "Armin Burgmeier" <armin arbur net>
- Cc: gtkmm-list <gtkmm-list gnome org>
- Subject: Re: Console screen from spawn_process
- Date: Thu, 23 Oct 2008 12:07:30 -0200
I compile my application and MPlayer with the consoles (without -mwindows). So, when I run the mplayer inside my application using spawn_async_with_pipes and get the integers stdin and stdout I can use the function write(&stdin, command, strlen(command)) and mplayer response. When compile my application and MPlayer without console (without -mwindows) the console screen aren't shown, I got the stdout by a thread in my program but when I try to send commands throw the write function I got no response from mplayer...
I start to think that the best solution is to use the CreateProcess function. As you sad before, you don't need to rebuild the process child with -mwindows and with the STARTF_USESHOWWINDOW and SW_HIDE
you can hide the console.
I implemented the method by I don't know how to handle with the stdin and stdout.
The code:PROCESS_INFORMATION processInfo;STARTUPINFO startupInfo;
memset(&startupInfo, 0, sizeof(startupInfo));
startupInfo.cb = sizeof(startupInfo);startupInfo.dwFlags = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES;
startupInfo.wShowWindow = SW_HIDE;startupInfo.hStdInput = (HANDLE)_get_osfhandle(0);
startupInfo.hStdOutput = (HANDLE)_get_osfhandle(1);startupInfo.hStdError = (HANDLE)_get_osfhandle(2);
CreateProcess(NULL, "C:\\mplayer\\mplayer.exe C:\\mplayer\\sample.mpeg", NULL, NULL, false, 0, NULL, NULL, &startupInfo, &processInfo);
Thanks for the support...
Paulo Flabiano Smorigo
] [Thread Prev