Re: Console screen from spawn_process



Hi Armin,

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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]