
Hiding a dialog based app on startup
--------------C3C6EA16405F99DD64E438BD
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Quote:
> I tried using ModifyStyle( ) to remove the WS_VISIBLE style in
> OnInitDialog( ) but it returns 0 (meaning it didn't work). I also
> tried setting the showCmd of the WINDOWPLACEMENT structure to SW_HIDE
> before I apply it. Something is going on here or I'm just not tapping
> into the right place to change the 'window' attributes. Especially
> since I can't use PreCreateWindow( ) with a dialog based app.
> Felipe
Quote:
> : > Environment: Windows NT4sp3, Visual C++ 5.0
> : >
> : > How can I start a Dialog based app hidden? I have tried calling
> : > ShowWindow(SW_HIDE) in OnInitDialog( ) and also setting a value
> for
> : > m_nCmdShow in the App's InitInstance( ) but they don't work. I am
> : > trying not to draw the window at all to eliminate showing it then
> : > hiding it (causing a flash on the screen).
> :
> : I wonder what would happen if you removed the WS_VISIBLE style from
> the
> : dialog in OnInitDialog?
Felipe,
Do you want the dialog-based app to just perform some pre-selected
actions and then terminate without ever having been displayed? If that
is the case, you can just put an EndDialog call in your OnInitDialog
method. Although it sounds questionable, it is perfectly legit.
However, if that was not the case and you need a work-around for your
visibility situation, you might try placing your dialog at some large
negative coordinates such as -5000, -5000 (via SetWindowPos or
MoveWindow) so that it would at least be off-screen. Of course, you
might run into problems since it would probably show up as a running
process in the task list, on the task bar, and in the alt-tab list, but
I don't know if that is undesirable for your situation. (I am only
suggesting this mechanism as a potential work-around until you get a
handle on whatever is really going on).
Regards,
= Jeff =
--------------C3C6EA16405F99DD64E438BD
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<HTML>
<BODY BGCOLOR="#FFFFFF">
<BLOCKQUOTE TYPE=CITE><FONT FACE="Arial"><FONT COLOR="#000000"><FONT SIZE=-1>I
tried using ModifyStyle( ) to remove the WS_VISIBLE style in OnInitDialog(
) but it returns 0 (meaning it didn't work). I also tried setting
the showCmd of the WINDOWPLACEMENT structure to SW_HIDE before I apply
it. Something is going on here or I'm just not tapping into the right
place to change the 'window' attributes. Especially since I can't
use PreCreateWindow( ) with a dialog based app.</FONT></FONT></FONT>
<P><FONT FACE="Arial"><FONT COLOR="#000000"><FONT SIZE=-1>Felipe</FONT></FONT></FONT>
<P><FONT FACE="Arial"><FONT SIZE=-1><FONT COLOR="#000000">Cecil A. Galbraith
<BR><FONT FACE="Arial"><FONT COLOR="#000000"><FONT SIZE=-1>: Felipe Jordão
<BR><FONT FACE="Arial"><FONT COLOR="#000000"><FONT SIZE=-1>: > Environment:
Windows NT4sp3, Visual C++ 5.0</FONT></FONT></FONT>
<BR><FONT FACE="Arial"><FONT COLOR="#000000"><FONT SIZE=-1>: ></FONT></FONT></FONT>
<BR><FONT FACE="Arial"><FONT COLOR="#000000"><FONT SIZE=-1>: > How can
I start a Dialog based app hidden? I have tried calling</FONT></FONT></FONT>
<BR><FONT FACE="Arial"><FONT COLOR="#000000"><FONT SIZE=-1>: > ShowWindow(SW_HIDE)
in OnInitDialog( ) and also setting a value for</FONT></FONT></FONT>
<BR><FONT FACE="Arial"><FONT COLOR="#000000"><FONT SIZE=-1>: > m_nCmdShow
in the App's InitInstance( ) but they don't work. I am</FONT></FONT></FONT>
<BR><FONT FACE="Arial"><FONT COLOR="#000000"><FONT SIZE=-1>: > trying not
to draw the window at all to eliminate showing it then</FONT></FONT></FONT>
<BR><FONT FACE="Arial"><FONT COLOR="#000000"><FONT SIZE=-1>: > hiding it
(causing a flash on the screen).</FONT></FONT></FONT>
<BR><FONT FACE="Arial"><FONT COLOR="#000000"><FONT SIZE=-1>:</FONT></FONT></FONT>
<BR><FONT FACE="Arial"><FONT COLOR="#000000"><FONT SIZE=-1>: I wonder what
would happen if you removed the WS_VISIBLE style from the</FONT></FONT></FONT>
<BR><FONT FACE="Arial"><FONT COLOR="#000000"><FONT SIZE=-1>: dialog in
OnInitDialog?</FONT></FONT></FONT></BLOCKQUOTE>
Felipe,
<P>Do you want the dialog-based app to just perform some pre-selected actions
and then terminate without ever having been displayed? If that is
the case, you can just put an EndDialog call in your OnInitDialog method.
Although it sounds questionable, it is perfectly legit.
<P>However, if that was not the case and you need a work-around for your
visibility situation, you might try placing your dialog at some large negative
coordinates such as -5000, -5000 (via SetWindowPos or MoveWindow) so that
it would at least be off-screen. Of course, you might run into problems
since it would probably show up as a running process in the task list,
on the task bar, and in the alt-tab list, but I don't know if that is undesirable
for your situation. (I am only suggesting this mechanism as a potential
work-around until you get a handle on whatever is really going on).
<P>Regards,
<P>= Jeff =
<BR>
</BODY>
</HTML>
--------------C3C6EA16405F99DD64E438BD--