Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


$#% MFC!!!

This topic is 6009 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

This is probably very easy, but its getting late and I''m tired of searching... So... how the $@# can I make an MFC dialog-based application start with an invisible window? I''ve tried all sorts of things but none worked. I tried not setting the "Visible" flag in the dialog editor, overriding the WS_VISIBLE flag in PreCreateWindow() and a few other tricks like those. I''m out of ideas. Can anyone give me a few pointers? Thanks!

Share this post

Link to post
Share on other sites
I think I may know, by any chance is there a WinProc() function for an event handler (I tried MFC but couldn''t do it...) if there is just don''t run validateRect() then there will be not window... I think... or i''m crazy...

Share this post

Link to post
Share on other sites
There are a couple ways I can think of... override OnPaint() maybe, or look up WS_HIDE in MSDN. It all depends on what you''re trying to do but dlg->Show(... , SW_HIDE) should work.

Share this post

Link to post
Share on other sites
I just so happened to be reading CodeProject.com and read an article explaining how this is done...

Here''s how you do it:

Add a BOOL member to your dialog class and call it something, say m_visible.

Now in your dialog constructor set visible to false.

visible = false;
Now you need to override WM_WINDOWPOSCHANGING. You might have to change your message filtering options to have this message show up in the Class Wizard.

void CTest_deleteDlg::OnWindowPosChanging(WINDOWPOS FAR* lpwndpos)
lpwndpos->flags &= ~SWP_SHOWWINDOW;



That''s it. Now your modal dialog actually starts up in a hidden state. And when you want to make it visible this is what you need to do.

visible = true;

Note: this was taken right from the articel that can be found here:http://www.codeproject.com/useritems/dlgboxtricks.asp

Dave "Dak Lozar" Loeser †

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!