Prev: turn on INT13Ex
Next: Low Fragmentation Heap mechanism
From: Jonathan de Boyne Pollard on 10 May 2010 11:08 > > > The compiler uses stdout/stderr, which causes a console window to be > created [...] > No. What causes the console window to be created is that the command interpreter that %COMSPEC% points to is marked as a Windows Character Mode executable. It cannot be determined ahead of time, i.e. before the program is launched into a child process, whether a program will use its standard handles. But the subsystem field in the PE header is available ahead of time, and that is what is used to determine whether the child process has a console.
From: Franz Bachler on 3 Jun 2010 09:47 Hello all, the solution is CreateProcess, this doesn't flicker under the NT-Line but it flickers under 9x. Under 9x WinExec works but WinExec doesn't wait until the subprocess terminated. Here helps only Sleep() with sufficient delay. Greetings, Franz { STARTUPINFO si; PROCESS_INFORMATION pi; OSVERSIONINFO osvi; BOOL bS=FALSE; TCHAR szCommand=TEXT("dosprog argument"); ZeroMemory(&osvi, sizeof(OSVERSIONINFO)); osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&osvi); ZeroMemory(&si, sizeof(si)); si.cb = sizeof(si); // Start the child process. if (osvi.dwMajorVersion>=5) { bS=CreateProcess ( NULL, // No module name (use command line) szCommand, // Command line NULL, // Process handle not inheritable NULL, // Thread handle not inheritable FALSE, // Set handle inheritance to FALSE CREATE_NO_WINDOW, // Creation flags NULL, // Use parent's environment block NULL, // Use parent's starting directory &si, // Pointer to STARTUPINFO structure &pi // Pointer to PROCESS_INFORMATION structure ); } if (bS) { WaitForSingleObject(pi.hProcess, INFINITE); // Close process and thread handles. CloseHandle(pi.hProcess); CloseHandle(pi.hThread); } else { WinExec(szHelp, SW_HIDE); Sleep(650); } }
|
Pages: 1 Prev: turn on INT13Ex Next: Low Fragmentation Heap mechanism |