Using Timer for splash screen

Posted on 1998-09-09
Last Modified: 2013-11-20
Hi, I want to use timer to control the splash screen at the start of my dialog based app., how can I do that? Please describe complete procedure step by step.
Waiting for help
Question by:Moin
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
  • 2
  • 2

Expert Comment

ID: 1322009
You could add the splash screen component this does it for you

Author Comment

ID: 1322010
But splash screen component work in doc/view architecture, where CMainFrm is present. I  want to ask how to put it in dialog based app.

Expert Comment

ID: 1322011
I've look at one I've used and can't see why you think its dependant upon CMainFrm.

Accepted Solution

plebel earned 20 total points
ID: 1322012
personely, i use a my about box (a CDialog based class).
My about box is caption free and screen centered.
When i use it as a splash screen, i hide the "OK" button and i close it by the timer.

here is the code (which is not a big secret anyway)

By the way, i use the "int GoAbout(UINT Idd)" function to open it as a dialog and "BOOL SplashOn(UINT Idd)" function to open it as a splash screen

// About.h : header file

BOOL SplashOn(UINT Idd, LPTSTR lpKeySubClass = 0, LPTSTR lpKeySubClass1 = 0);
void SplashOff();
int GoAbout(UINT Idd);

#define IDC_INFO 100
#define IDB_DEMO 101

// CAbout dialog

class CAbout : public CDialog
// Construction
      CAbout(UINT Idd,BOOL bSplash,CWnd* pParent = NULL);   // standard constructor

// Dialog Data
      //enum { IDD = IDD_ABOUT };
            // NOTE: the ClassWizard will add data members here

// Overrides
      // ClassWizard generated virtual function overrides
      virtual BOOL DestroyWindow();
      virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

// Implementation

      // Generated message map functions
      virtual BOOL OnInitDialog();
      afx_msg void OnTimer(UINT nIDEvent);
      BOOL m_bTimer;
      BOOL m_bSplash;
      HINSTANCE m_hInstance;

// CAbout dialog

// About.cpp : implementation file

#include "stdafx.h"
#include "About.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;

static CAbout *pAbout = NULL;

BOOL SplashOn(UINT Idd)
      if (!pAbout)
            pAbout = new CAbout(Idd,TRUE);
      return TRUE;

void SplashOff()
      if (pAbout)
            delete pAbout;
            pAbout = NULL;

int GoAbout(UINT Idd)
      CAbout About(Idd,FALSE);
      return TRUE;

// CAbout dialog

CAbout::CAbout(UINT Idd,BOOL bSplash,CWnd* pParent /*=NULL*/)
      : CDialog(Idd, pParent), CVersionInfo()
            // NOTE: the ClassWizard will add member initialization here

      m_bSplash = bSplash;
      m_hInstance = AfxGetInstanceHandle();


void CAbout::DoDataExchange(CDataExchange* pDX)
            // NOTE: the ClassWizard will add DDX and DDV calls here


// CAbout message handlers

BOOL CAbout::OnInitDialog()
      // TODO: Add extra initialization here

      if (m_bSplash)
             GetDlgItem( IDOK )->ShowWindow(SW_HIDE);

             // set timer for 5 sec
             m_bTimer = TRUE;
            m_bTimer = FALSE;

      return TRUE;

BOOL CAbout::DestroyWindow()

      if (m_bTimer)
            m_bTimer = 0;
      return CDialog::DestroyWindow();

void CAbout::OnTimer(UINT nIDEvent)
      if (nIDEvent == 1)


Expert Comment

ID: 1322013
better replace
BOOL SplashOn(UINT Idd, LPTSTR lpKeySubClass = 0, LPTSTR lpKeySubClass1 = 0);

BOOL SplashOn(UINT Idd);


Featured Post

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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.
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

630 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