Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. ATL based spash screen

ATL based spash screen

Scheduled Pinned Locked Moved C / C++ / MFC
c++question
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    koteswara
    wrote on last edited by
    #1

    Hi, Anybody have sample code about ATL based SPLASH dialog? Best Regards, Perumalla Koteswara Rao, JUNO Online Dev. Pvt. Ltd. Hyderabad, India

    P 1 Reply Last reply
    0
    • K koteswara

      Hi, Anybody have sample code about ATL based SPLASH dialog? Best Regards, Perumalla Koteswara Rao, JUNO Online Dev. Pvt. Ltd. Hyderabad, India

      P Offline
      P Offline
      Paul M Watt
      wrote on last edited by
      #2

      This code is off of the top of my head. I have done a few splash screens this way, I know there are other ways to accomplish this, but this has worked for me. class CSplashDlg : public CDialogImpl { private: int m_CurTime; int m_DisplayTime; public: enum { IDD = IDD_ABOUTBOX, SPLASH_TIMER = 100 }; BEGIN_MSG_MAP(CAboutDlg) MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) COMMAND_ID_HANDLER(IDOK, OnCloseCmd) COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd) MESSAGE_HANDLER(WM_TIMER, OnTimer) MESSAGE_HANDLER(WM_DESTROY, OnDestroy) END_MSG_MAP() LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { CenterWindow(GetParent()); m_CurTime = 0; m_DisplayTime = 6; // 6 half-second counts equals 3 seconds before the window disappears. //C: The timer is set for half second resolution. this->SetTimer(SPLASH_TIMER, 500, NULL); return TRUE; } LRESULT OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { EndDialog(wID); return 0; } LRESULT OnTimer(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) { if (SPLASH_TIMER == wParam) { ++m_CurTime; if (m_CurTime > m_DisplayTime) { this->DestroyWindow(); } } return TRUE; } LRESULT OnDestroy(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) { this->KillTimer(SPLASH_TIMER); return TRUE; } }; Like I said this is off the top of my head, so you may need to fix any compiler errors that I have made. There is probably a better way to destroy the timer that I have created. Create this dialog with a modeless call with something like this: CSplashDlg dlgSplash; dlgSplash.ShowWindow(SW_NORMAL); With the way that it is currently written, it will disappear after 3 seconds. You can change the m_DisplayTime value in order to lengthen or shorten the time that the dialog is displayed. ONe more thing you may want to mess around with the window styles in order to make this dialog top most and whatever else.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups