Solved

Hide CMainFrame window until splash screen disappears

Posted on 1998-08-27
5
569 Views
Last Modified: 2013-11-19
I've got an SDI app. i have a splash screen. i want now that
the main window does not appear until the splash screen
is destroyed.
I've tried:
  CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
      ShowWindow(SW_HIDE);
      ModifyStyle(0, (DWORD)WS_VISIBLE);
CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
      cs.style &= ~WS_VISIBLE;

none of this worked. my mainframe window should be
invisible until the splash screen is destroyed (where i call
AfxGetMainWnd->ShowWindow(SW_SHOW) to display my mainframe.
how can i do this?
0
Comment
Question by:wbk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 2

Accepted Solution

by:
duneram earned 50 total points
ID: 1321360
Possible solutions:
1) Hide your main window.  have your splash screen on destruction, post a message to your main window.  When you receive that message, make your window WS_VISIBLE, or use ShowWindow and show it at that point.

2)  Use the SetWindowPos Api in the OnInitDialog method to move your screen out of bounds (use getsystemmetrics(SM_CXSCREEN), and then set the top left to what isn't visible.  Then when your splash screen destructs, post a message to your main window.  Handle that message by moving your window into view with the SetWindowPos api.


0
 
LVL 1

Author Comment

by:wbk
ID: 1321361
hello durenam
i'd prefer the first solution
Possible solutions:
    1) Hide your main window. ...
  that's what i tried but i could not entirely hide the window it shows up for a very short
 moment i've tried the following to hide the window but none of it worked:
  CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
          ShowWindow(SW_HIDE);
          ModifyStyle(0, (DWORD)WS_VISIBLE);
    CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
          cs.style &= ~WS_VISIBLE;
so, do you know WHERE and HOW to hide the MainFrame window?

0
 
LVL 2

Expert Comment

by:duneram
ID: 1321362
sure,

Go to your  main app source code's InitInstance routine

BOOL CYourApp::InitInstance()
{

Near the end of that function, find the

      // The one and only window has been initialized, so show and update it.
      m_pMainWnd->ShowWindow(SW_SHOW);
 Change that to SW_HIDE

You need to make that m_pMainWnd pointer available to your splash screen.  If its a separate window object, then you need to ensure the destructor of it tells your main window to 'SW_SHOW'.


0
 
LVL 1

Author Comment

by:wbk
ID: 1321363
Thanks,
     it's kind of strange I did this before but my main frame still is visible for a very short
     moment (not the whole just the frame and part of the inside)
     perhaps it has something to do that i have several views (used a splitter
    window for every view perhaps they try to show up after construction?


0
 
LVL 1

Author Comment

by:wbk
ID: 1321364
Thanks,
     it's kind of strange I did this before but my main frame still is visible for a very short
     moment (not the whole just the frame and part of the inside)
     perhaps it has something to do that i have several views (used a splitter
    window for every view perhaps they try to show up after construction?


0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question