From: Guido Franzke on
Hello NG,

I start a process with CreateProcess. The called exe is a Win32 App that is
run in a dos console. So CreateProcess opens the DOS console window.
But I don't want show the DOS window or I want show it minimized.
So I made following:

STARTUPINFO startupInfo;
PROCESS_INFORMATION processInfo;
GetStartupInfo( &startupInfo );
startupInfo.dwFlags |= STARTF_USESHOWWINDOW;
//startupInfo.wShowWindow=0; // Don't show DOS window
startupInfo.wShowWindow=SW_SHOWMINIMIZED; // minimize DOS window

DWORD dwCreate = NORMAL_PRIORITY_CLASS;

if (!CreateProcess("opt.exe",NULL,NULL,NULL,TRUE,dwCreate,NULL,NULL,
&startupInfo,&processInfo))
{
return false;
}
//DWORD pidOptim = processInfo.dwProcessId;


But the DOS window is not minimized (nor not shown although I have
ShowWindow=0).
Do you know, where is the mistake?

Another solution is to change my Win32 application. But what function is
used to get the window handle hWnd in my Win32 app's _tmain() to use in
ShowWindow(hWnd, SW_SHOWMINIMIZED)?

Thanks for help,
Guido


From: Igor Tandetnik on
Guido Franzke <guidof73(a)yahoo.de> wrote:
> I start a process with CreateProcess. The called exe is a Win32 App
> that is run in a dos console. So CreateProcess opens the DOS console
> window.
> But I don't want show the DOS window or I want show it minimized.

Pass DETACHED_PROCESS flag in the sixth parameter to suppress the console altogether. I don't know of any way to start the console minimized.

> Another solution is to change my Win32 application. But what function
> is used to get the window handle hWnd in my Win32 app's _tmain() to
> use in ShowWindow(hWnd, SW_SHOWMINIMIZED)?

CreateWindow. Your Win32 app is expected to create its own window(s). If it doesn't, it won't have any so there would be nothing to minimize. Also, the entry point for your Win32 application would be WinMain, not main.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not necessarily a good idea. It is hard to be sure where they are going to land, and it could be dangerous sitting under them as they fly overhead. -- RFC 1925

From: Guido Franzke on
Yeah, CreateFlag is it. I make CREATE_NO_WINDOW and the window is not shown.
Thanks for your hint.




"Igor Tandetnik" <itandetnik(a)mvps.org> schrieb im Newsbeitrag
news:%23V344GcqKHA.1936(a)TK2MSFTNGP06.phx.gbl...
Guido Franzke <guidof73(a)yahoo.de> wrote:
> I start a process with CreateProcess. The called exe is a Win32 App
> that is run in a dos console. So CreateProcess opens the DOS console
> window.
> But I don't want show the DOS window or I want show it minimized.

Pass DETACHED_PROCESS flag in the sixth parameter to suppress the console
altogether. I don't know of any way to start the console minimized.

> Another solution is to change my Win32 application. But what function
> is used to get the window handle hWnd in my Win32 app's _tmain() to
> use in ShowWindow(hWnd, SW_SHOWMINIMIZED)?

CreateWindow. Your Win32 app is expected to create its own window(s). If it
doesn't, it won't have any so there would be nothing to minimize. Also, the
entry point for your Win32 application would be WinMain, not main.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not necessarily
a good idea. It is hard to be sure where they are going to land, and it
could be dangerous sitting under them as they fly overhead. -- RFC 1925