How to make any form hidden...

J

Jigar Mehta

Hye friends!!!
A silly question but still harassing me. I am developing one project and
in that I want full support of MFC. So, what I have to make is make one
project by Wizard (for MFC-->Dialog Application).. Now I want to hide that
dialog when initializing and start some of the threads depending on the
conditions... (threading part is ready but hiding a dialog makes me
annoying) So, the dialog must not appear one time also, it must be initially
hidden.

I know there would be four or five line of code for doing that but I
don't know it right now.. So, if you have it handy please give me..
 
W

William DePalo [MVP VC++]

Jigar Mehta said:
Now I want to hide that
dialog when initializing and start some of the threads depending on the
conditions... (threading part is ready but hiding a dialog makes me
annoying) So, the dialog must not appear one time also, it must be initially
hidden.

I know there would be four or five line of code for doing that but I
don't know it right now.. So, if you have it handy please give me..

Dialogs are windows of a particular class. Windows may be shown or hidden by
calling ShowWindow(). There the SW_HIDE flag can be used used to hide it and
SW_SHOWNORMAL can be used to display it.

Note that modal dialogs should not be hidden. That's because the "dialog
manager wants" to disable the parent/owner while a dialog is in progress.
Modeless dialogs, howver, may be shown or hidden as you like.

Regards,
Will
 
J

Jigar Mehta

Thanks william for replying,
But what I want to do is want to put some code for hiding form in the
initInstance() function of the dialog itself. So that the dialog is not
shown once also. I am afraid that showwindow(SW_HIDE) will work in
initinstance...

Thank you..

Jigar Mehta
(e-mail address removed)

Jigar Mehta said:
Now I want to hide that
dialog when initializing and start some of the threads depending on the
conditions... (threading part is ready but hiding a dialog makes me
annoying) So, the dialog must not appear one time also, it must be initially
hidden.

I know there would be four or five line of code for doing that but I
don't know it right now.. So, if you have it handy please give me..

Dialogs are windows of a particular class. Windows may be shown or hidden by
calling ShowWindow(). There the SW_HIDE flag can be used used to hide it and
SW_SHOWNORMAL can be used to display it.

Note that modal dialogs should not be hidden. That's because the "dialog
manager wants" to disable the parent/owner while a dialog is in progress.
Modeless dialogs, howver, may be shown or hidden as you like.

Regards,
Will
 
W

William DePalo[MVPVC++]

Jigar Mehta said:
Thanks william for replying,

You are welcome.
But what I want to do is want to put some code for hiding form in the
initInstance() function of the dialog itself. So that the dialog is not
shown once also. I am afraid that showwindow(SW_HIDE) will work in
initinstance...

In the resource editor, design a modeless dialog which does not have the
WS_VISIBLE style. Then when you create it at runtime you will get a handle
to an invisible window. You can use that handle in a call to ShowWindow()
todisplay it.

As I mentioned in my last post, do not try to manage the visibility of modal
dialogs.

Regards,
Will
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top