Answers2000
asked on
Hiding batch file's console
This is a follow up on https://www.experts-exchange.com/jsp/qShow.jsp?ta=winprog&qid=10224880
I have a Win32 console program. It is complicated but of old-design full of printf's etc. I need the program to be invisible while running. I do this by calling FreeConsole. This much works
The question is: the console program also kicks off batch files using system("file.bat"); Each type a batch file runs a console flashes up while it is running. Is there anyway to hide these consoles.
Any quick fix simple solution gets an A
I have a Win32 console program. It is complicated but of old-design full of printf's etc. I need the program to be invisible while running. I do this by calling FreeConsole. This much works
The question is: the console program also kicks off batch files using system("file.bat"); Each type a batch file runs a console flashes up while it is running. Is there anyway to hide these consoles.
Any quick fix simple solution gets an A
ASKER
setting pszCmd is probably the trick I missed!
i can't test it till Friday, but I'll let you know then or soon after
What does /c option do ?
i can't test it till Friday, but I'll let you know then or soon after
What does /c option do ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory ( &si, sizeof ( STARTUPINFO));
si.cb = sizeof ( STARTUPINFO);
si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = SW_HIDE;
bRes = CreateProcess ( NULL,
pszCmd, // command line, sth. like 'cmd.exe /c file.bat'
NULL,
NULL,
TRUE,
NORMAL_PRIORITY_CLASS,
GetEnvironmentStrings (),
NULL,
&si,
&pi
);
CloseHandle( pi.hProcess);
CloseHandle( pi.hThread);