Re: Executing system() command without console popping ...
From: Doug Harrison [MVP] (dsh_at_mvps.org)
Date: 02/08/05
- Next message: William DePalo [MVP VC++]: "Re: Executing system() command without console popping ..."
- Previous message: Carl Daniel [VC++ MVP]: "Re: HOWTO Load and Run EXEs and DLLs from a custom made "LoadLibrary""
- In reply to: William DePalo [MVP VC++]: "Re: Executing system() command without console popping ..."
- Next in thread: William DePalo [MVP VC++]: "Re: Executing system() command without console popping ..."
- Reply: William DePalo [MVP VC++]: "Re: Executing system() command without console popping ..."
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 08 Feb 2005 16:15:28 -0600
William DePalo [MVP VC++] wrote:
>"Doug Harrison [MVP]" <dsh@mvps.org> wrote in message
>news:4k3i01pvpumjaot8m8jk6lbk8utpscapa5@4ax.com...
>> I recommend doing both, as SW_HIDE doesn't seem to hurt anything,
>
>I don't think it does either, Doug. But I just wonder about the possibility
>for confusion when on the one hand you tell a function not to create a
>window and on the other tell it to hide it.
>
>In any event, I just now set the default for cmd windows to be full-screen
>and tried my hack again on XP/SP2. No window that I could see, no switch to
>full-screen mode.
>
>Then I copied the hack to an old and slow 2K box, set the default to be
>full-screen and got the same result.
>
>I wonder if the results depend on the image that the created process runs?
If the hack is to use CREATE_NO_WINDOW, that's the solution to the problem,
and I approve of the hack! :) The problem is caused by using SW_HIDE by
itself, which apparently is what most people have been doing for years, and
what my example demonstrated. The SW_HIDE method is pretty much the only
option for Win9X, where CREATE_NO_WINDOW isn't supported. For NT, SW_HIDE
continues to work modulo the problem I described, and breaking SW_HIDE
completely would mess up a lot of programs, including VC6 and VS.NET, not to
mention everyone who followed MS examples such as the one in that KB article
I cited. That said, to avoid the full-screen problem in NT, you _must_ use
CREATE_NO_WINDOW.
It turns out I'm more paranoid than I remember. I only "use both" on
NT-based Windows. On Win9X, I just use SW_HIDE. Here's my CreateProcess
setup code:
PROCESS_INFORMATION p;
STARTUPINFO s = { sizeof(STARTUPINFO) };
s.dwFlags = STARTF_USESHOWWINDOW;
s.wShowWindow = SW_HIDE;
DWORD creationFlags = 0;
if (OsVersion::AtLeastNT4())
creationFlags |= CREATE_NO_WINDOW;
I've found this works well across the board.
-- Doug Harrison Microsoft MVP - Visual C++
- Next message: William DePalo [MVP VC++]: "Re: Executing system() command without console popping ..."
- Previous message: Carl Daniel [VC++ MVP]: "Re: HOWTO Load and Run EXEs and DLLs from a custom made "LoadLibrary""
- In reply to: William DePalo [MVP VC++]: "Re: Executing system() command without console popping ..."
- Next in thread: William DePalo [MVP VC++]: "Re: Executing system() command without console popping ..."
- Reply: William DePalo [MVP VC++]: "Re: Executing system() command without console popping ..."
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|