I want my dialog to be hidden at startup. I have tried to achieve it using several ways, but nothing works :( I have tried setting the Visible property of the dialog to false, I have called ShowWindow at WM_CREATE and WM_INITDIALOG.

I think it's possible to do it if I set the dialog width to 0, and then resize and center the dialog manually after loading it, but that would need alot of extra code.

Is there a 'proper' way of doing it?

Posted on 2002-09-03 15:41:10 by Delight
Without some code to play with its hard to tell what will work or not.

An easy (dirty) solution without much coding would be to start the
window at some location thats off screen, say at -2000, -2000...

Actually I am not sure about dialogs at all. Can a dialogs position
be started where you want or is one always centered?
Posted on 2002-09-03 17:35:24 by Graebel
according to the api ref on DialogBoxParam there is no way to
do it with flags like WS_VISIBLE... mh stange it doesn't even work
when using ShowWindow on WM_INITDIALOG, but however use
and your window should be hidden now. can i ask a question? why
don't you want your window shown at startup? in case you're doing
some calculation or something else don't forget that YOU have full
controll over the Dilaog Callback procedure, so no RET no window :)
but yes, i would recommend the SetWndPos method
Posted on 2002-09-03 19:45:10 by mob
Graebel, moving the dialog off screen is an alternative and I was thinking of something similar, but I agree with you, it's a dirty way of solving the problem. Dialogs will only be centered if you set their StartupPos property to CenterScreen (I'm using RadASM).

mob, no calculations are made during startup, it's a small utility that pops up when using a hotkey. I will try your code. Thanks!
Posted on 2002-09-04 01:57:48 by Delight
Either starting or moving a window off screen may be unusual but its clean safe code that has no problems so I would not worry about doing it. Its one way to avoid autostartup animation if thats not what you want with your app.


Posted on 2002-09-04 06:31:06 by hutch--