15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Annoying problem displaying Splash Window..

Serge Wautier -- serge.wautier@ontonet.be
Wednesday, March 05, 1997

[Mini-digest: 9 responses]

Set the WS_EX_TOPMOST style for your splash window. One way to do it is :

m_splash.SetWindowPos(&wndTopMost,...,SWP_NOMOVE|SWP_NORESIZE);

Hope this helps,

Serge Wautier,
Techno Trade s.a.
Belgium
serge.wautier@ontonet.be
http://www.tbox.fr

----------
> From: Mihir Dalal 
> To: mfc-l@netcom.com
> Subject: Annoying problem displaying Splash Window..
> Date: mardi 4 mars 1997 8:30
> 
> 
>                    Environment: MSVC 1.52, Win 95
> Hi, 
> 
> I have written the following in CMyApp::InitInstance() to display a 
> splash window at startup
> 
> BOOL CMyApp::InitInstance()
> {
>   ....
>   ....
>   
>   int nCmdShow = m_nCmdShow;    // Initialize nCmdShow              
>                                                   
>   m_pMainWnd->UpdateWindow();                       	     	
>   if (m_splash.Create(m_pMainWnd)) // m_splash is a dialog object dervied

>    {                               // from CDialog                
>      Splash Window 
>      m_splash.ShowWindow(SW_SHOW);                                  
>      m_splash.UpdateWindow();                                      
>    }                                                                  
>    m_dwSplashTime = ::GetCurrentTime();                         
>     
>   ....
>   ....
> }	
> 
> 
> Corrospondingly, the follwing in the overrriden OnIdle() takes care of 
> killing the splash window after 4 seconds.
> 
> BOOL CmYApp::OnIdle(LONG lCount)                         
> {                                                                      
> 	// call base class idle first                                 
> 	BOOL bResult = CWinApp::OnIdle(lCount);                          
>                                                           
> 	// then do our work                                         
> 	if (m_splash.m_hWnd != NULL)                            
> 	{                                                          
>           if (::GetCurrentTime() - m_dwSplashTime > 4000)       
>            {                                                         
>             // timeout expired, destroy the splash window             
>             m_splash.DestroyWindow();                              
>             m_pMainWnd->ShowWindow(SW_SHOW);
> 	    m_pMainWnd->UpdateWindow();                    
>                                                           
> 	    // NOTE: don't set bResult to FALSE,        
> 	    // CWinApp::OnIdle may have returned TRUE           
> 	}                                                       
> 	else                                                     
>         {                                                            
> 	    // check again later...                       
> 	   bResult = TRUE;                          
> 		
>         }                                                            
>      }                                                             
>   return bResult;                                                   
> }               
> 
> 
> My problem, is that the mainframe of my application covers up the splash 
> window after roughly one and a half second. The rest of the time, (2 and 
> a half seconds) the splash window does exist but gets covered up by the 
> application main window.
> 
> Is there a way to retain the splash window as the top level window even 
> as windows creates the application main window ??
> 
> Mihir. 
> 
>
____________________________________________________________________________

>      Mihir Dalal , M.Engg. (Electrical) Student
>               Department of Electrical and Computer Engineering
>                    Concordia University, Montreal, Canada
>                 http://www.ECE.Concordia.CA/~m_dalal/addr.html
-----From: CADS Software Developer 

I would think that you could use the method that all stay on top windows
use - which is using SetWindowPos as follows:-

m_splash.SetWindowPos(&wndTopMost, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);

The best place for this is after the call to UpdateWindow in your
InitInstance.

@:-) Jonathan Cox (jonathan@pindar.com)

----------
> From: Mihir Dalal 
> To: mfc-l@netcom.com
> Subject: Annoying problem displaying Splash Window..
> Date: 04 March 1997 07:30
> 
> 
>                    Environment: MSVC 1.52, Win 95
> Hi, 
> 
> I have written the following in CMyApp::InitInstance() to display a 
> splash window at startup
> 
> BOOL CMyApp::InitInstance()
> {
>   ....
>   ....
>   
>   int nCmdShow = m_nCmdShow;    // Initialize nCmdShow              
>                                                   
>   m_pMainWnd->UpdateWindow();                       	     	
>   if (m_splash.Create(m_pMainWnd)) // m_splash is a dialog object dervied

>    {                               // from CDialog                
>      Splash Window 
>      m_splash.ShowWindow(SW_SHOW);                                  
>      m_splash.UpdateWindow();                                      
>    }                                                                  
>    m_dwSplashTime = ::GetCurrentTime();                         
>     
>   ....
>   ....
> }	
> 
> 
> Corrospondingly, the follwing in the overrriden OnIdle() takes care of 
> killing the splash window after 4 seconds.
> 
> BOOL CmYApp::OnIdle(LONG lCount)                         
> {                                                                      
> 	// call base class idle first                                 
> 	BOOL bResult = CWinApp::OnIdle(lCount);                          
>                                                           
> 	// then do our work                                         
> 	if (m_splash.m_hWnd != NULL)                            
> 	{                                                          
>           if (::GetCurrentTime() - m_dwSplashTime > 4000)       
>            {                                                         
>             // timeout expired, destroy the splash window             
>             m_splash.DestroyWindow();                              
>             m_pMainWnd->ShowWindow(SW_SHOW);
> 	    m_pMainWnd->UpdateWindow();                    
>                                                           
> 	    // NOTE: don't set bResult to FALSE,        
> 	    // CWinApp::OnIdle may have returned TRUE           
> 	}                                                       
> 	else                                                     
>         {                                                            
> 	    // check again later...                       
> 	   bResult = TRUE;                          
> 		
>         }                                                            
>      }                                                             
>   return bResult;                                                   
> }               
> 
> 
> My problem, is that the mainframe of my application covers up the splash 
> window after roughly one and a half second. The rest of the time, (2 and 
> a half seconds) the splash window does exist but gets covered up by the 
> application main window.
> 
> Is there a way to retain the splash window as the top level window even 
> as windows creates the application main window ??
> 
> Mihir. 
> 
>
____________________________________________________________________________

>      Mihir Dalal , M.Engg. (Electrical) Student
>               Department of Electrical and Computer Engineering
>                    Concordia University, Montreal, Canada
>                 http://www.ECE.Concordia.CA/~m_dalal/addr.html
> 
-----From: DFPav@aol.com

In a message dated 97-03-04 20:28:36 EST, you write:

> 
>  Is there a way to retain the splash window as the top level window even 
>  as windows creates the application main window ??
>  
>  Mihir. 
>  
How about you use the WS_EX_TOPMOST style for your splash window?
Then nothing will cover it!
Dan
-----From: Pal_Sukhram/svoa0008@ssb.com


--openmail-part-09913e9d-00000001
Content-Type: text/plain; charset=US-ASCII; name="RE:"



Vincent A. Busam -- vbusam@jetstream.com
Thursday, March 06, 1997

[Mini-digest: 3 responses]

We have a similar situation with pop-up message boxes.  Try:

BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
	cs.style &= ~WS_VISIBLE;
	return CFrameWnd::PreCreateWindow(cs);
}

Then make sure you show the mainframe after the splash window goes away.

We found this necessary because CDocManager::OnFileNew() in file
docmgr.cpp on line 673 calls pTemplate->OpenDocumentFile(NULL);
Since the second arugment (bMakeVisible) is not given in the call,
it defaults to TRUE which automatically shows the mainframe.

>-----From: Mihir Dalal 
>

>When I make the splash window the top level window as you'll suggested, 
>the messageboxes (of style MB_OK) both get hidden under the splash and my 
>application deadlocks there waiting for the MB_OK to be killed. 
>

-----From: Joao Marcos Melo Mendes 

Ahoy, :)

On Wed, 5 Mar 1997, Mihir Dalal wrote:

Environment: MSVC 1.52, Win 95

> > > Is there a way to retain the splash window as the top level window even 
> > > as windows creates the application main window ??



> Firstly, there are two reasons, why a messagebox would popup during 
> initial startup of my application when the splash window has been displayed, 
> and the mainframe of my application is being created. 



> When I make the splash window the top level window as you'll suggested, 
> the messageboxes (of style MB_OK) both get hidden under the splash and my 
> application deadlocks there waiting for the MB_OK to be killed. 

> Any help for that, or can I somehow make the messageboxes top level ??

I have a different suggestion for you, then. Instead of using 
SetWindowPos in your CMyApp.InitInstance, use the following:

CMySpalshWindow.OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized )
{
  if ( nState == WA_INACTIVE && pWndOther == AfxGetMainWnd() )
    SetWindowPos(wndTop,0,0,0,0,SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
}

Note: I have not tested this, so I can't be sure that it works. Anyways, 
Best-O-Luck(tm)! :)

                                        Joao Mendes
                                        MegaMedia, S.A.

"We're fools to make war on our brothers in arms." - Mark Knopfler

-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: 2.6.2

mQBNAzKu3TgAAAECAL8+YSEFZ0XrlBMu9t2xDq3rhpWZoscP83VrX5MevAm3UOd6
fOtDKsJxsWugnVMexo50NfBjeWOHz5nA1b9hYx0ABRG0H0pvYW8gTWVuZGVzIDxq
bW1tQG1lZ2FtZWRpYS5wdD4=
=sspP
-----END PGP PUBLIC KEY BLOCK-----





-----From: "Kenneth A. Argo" 

At the bottom of your InitInstance is a line that makes the window visible:

	// The main window has been initialized, so show and update it.
	m_pMainWnd->ShowWindow(SW_SHOW);
	m_pMainWnd->UpdateWindow();

What I do is remove these lines and have it happen when the splash screen goes away, that way everything appears to come and go in order.

Ken



----------
From:  Mihir Dalal[SMTP:m_dalal@ECE.concordia.CA]
Sent:  Tuesday, March 04, 1997 2:31 AM
To:  mfc-l@netcom.com
Subject:  Annoying problem displaying Splash Window..


                   Environment: MSVC 1.52, Win 95
Hi, 

I have written the following in CMyApp::InitInstance() to display a 
splash window at startup

BOOL CMyApp::InitInstance()
{
  ....
  ....
  
  int nCmdShow = m_nCmdShow;    // Initialize nCmdShow              
                                                  
  m_pMainWnd->UpdateWindow();                       	     	
  if (m_splash.Create(m_pMainWnd)) // m_splash is a dialog object dervied 
   {                               // from CDialog                
     Splash Window 
     m_splash.ShowWindow(SW_SHOW);                                  
     m_splash.UpdateWindow();                                      
   }                                                                  
   m_dwSplashTime = ::GetCurrentTime();                         
    
  ....
  ....
}	


Corrospondingly, the follwing in the overrriden OnIdle() takes care of 
killing the splash window after 4 seconds.

BOOL CmYApp::OnIdle(LONG lCount)                         
{                                                                      
	// call base class idle first                                 
	BOOL bResult = CWinApp::OnIdle(lCount);                          
                                                          
	// then do our work                                         
	if (m_splash.m_hWnd != NULL)                            
	{                                                          
          if (::GetCurrentTime() - m_dwSplashTime > 4000)       
           {                                                         
            // timeout expired, destroy the splash window             
            m_splash.DestroyWindow();                              
            m_pMainWnd->ShowWindow(SW_SHOW);
	    m_pMainWnd->UpdateWindow();                    
                                                          
	    // NOTE: don't set bResult to FALSE,        
	    // CWinApp::OnIdle may have returned TRUE           
	}                                                       
	else                                                     
        {                                                            
	    // check again later...                       
	   bResult = TRUE;                          
		
        }                                                            
     }                                                             
  return bResult;                                                   
}               


My problem, is that the mainframe of my application covers up the splash 
window after roughly one and a half second. The rest of the time, (2 and 
a half seconds) the splash window does exist but gets covered up by the 
application main window.

Is there a way to retain the splash window as the top level window even 
as windows creates the application main window ??

Mihir. 

____________________________________________________________________________
     Mihir Dalal , M.Engg. (Electrical) Student
              Department of Electrical and Computer Engineering
                   Concordia University, Montreal, Canada
                http://www.ECE.Concordia.CA/~m_dalal/addr.html






Become an MFC-L member | Вернуться в корень Архива |