Click to See Complete Forum and Search --> : Using Splash Screen
I am using the Splash Screen Component. My problem is that I would like the application window to wait to display until the Splash Screen has disappeared (just like VC6's splash screen is drawn before the application is displayed). What currently happens is both my application window and splash screen appear at the same time.
I tried putting a Sleep(4000) before:
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
but the application frame is still drawn, even though the contents are not drawn until 4 seconds later.
This is just a basic SDI application built with the AppWizard, and the Splash Screen componenent added.
Thanks in advance for any help.
If you used Developers Studio CSplashWnd try this:
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
if (!m_wndToolBar.Create(this) ||
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
// TODO: Remove this if you don't want tool tips or a resizeable toolbar
m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
// TODO: Delete these three lines if you don't want the toolbar to
// be dockable
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar);
///////////MOVE THIS///////////////////////////////////////////////
// CG: The following line was added by the Splash Screen component.
CSplashWnd::ShowSplashScreen(this);
///////////////////////////////////////////////////////////////////
return 0;
}
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
////// TO HERE ////////////////////////////////////////////////////
// CG: The following line was added by the Splash Screen component.
CSplashWnd::ShowSplashScreen(this);
Sleep(4000);
///////////////////////////////////////////////////////////////////
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
if (!m_wndToolBar.Create(this) ||
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
// TODO: Remove this if you don't want tool tips or a resizeable toolbar
m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
// TODO: Delete these three lines if you don't want the toolbar to
// be dockable
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar);
return 0;
}
That will do.
Bill.
Thanks Bill, that works great. Looking at the solution, it is obvious (now).
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.