home *** CD-ROM | disk | FTP | other *** search
- // tooltest.cpp : Defines the class behaviors for the application.
- //
-
- #include "stdafx.h"
- #include "tooltest.h"
-
- #include "mainfrm.h"
- #include "tooltdoc.h"
- #include "tooltvw.h"
-
- #ifdef _DEBUG
- #undef THIS_FILE
- static char BASED_CODE THIS_FILE[] = __FILE__;
- #endif
-
- /////////////////////////////////////////////////////////////////////////////
- // CTooltestApp
-
- BEGIN_MESSAGE_MAP(CTooltestApp, CWinApp)
- //{{AFX_MSG_MAP(CTooltestApp)
- ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
- // NOTE - the ClassWizard will add and remove mapping macros here.
- // DO NOT EDIT what you see in these blocks of generated code!
- //}}AFX_MSG_MAP
- // Standard file based document commands
- ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
- ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
- // Standard print setup command
- ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
- END_MESSAGE_MAP()
-
- /////////////////////////////////////////////////////////////////////////////
- // CTooltestApp construction
-
- CTooltestApp::CTooltestApp()
- {
- // TODO: add construction code here,
- // Place all significant initialization in InitInstance
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // The one and only CTooltestApp object
-
- CTooltestApp NEAR theApp;
-
- /////////////////////////////////////////////////////////////////////////////
- // CTooltestApp initialization
-
- BOOL CTooltestApp::InitInstance()
- {
- // Standard initialization
- // If you are not using these features and wish to reduce the size
- // of your final executable, you should remove from the following
- // the specific initialization routines you do not need.
-
- SetDialogBkColor(); // Set dialog background color to gray
- LoadStdProfileSettings(); // Load standard INI file options (including MRU)
-
- // Register the application's document templates. Document templates
- // serve as the connection between documents, frame windows and views.
-
- CMultiDocTemplate* pDocTemplate;
- pDocTemplate = new CMultiDocTemplate(
- IDR_TOOLTETYPE,
- RUNTIME_CLASS(CTooltestDoc),
- RUNTIME_CLASS(CMDIChildWnd), // standard MDI child frame
- RUNTIME_CLASS(CTooltestView));
- AddDocTemplate(pDocTemplate);
-
- // setup main window
- // Added line to make the initial frame be full screen
- m_nCmdShow = SW_SHOWMAXIMIZED;
-
- // create main MDI Frame window
- CMainFrame* pMainFrame = new CMainFrame;
- if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
- return FALSE;
- m_pMainWnd = pMainFrame;
-
- // create a new (empty) document
- OnFileNew();
-
- if (m_lpCmdLine[0] != '\0')
- {
- // TODO: add command line processing here
- }
- // Added these lines to do the splash screen stuff
- // *********************************
- else if (m_splash.Create(m_pMainWnd)) {
- m_splash.ShowWindow(SW_SHOW);
- m_splash.UpdateWindow();
- }
- m_dwSplashTime = ::GetCurrentTime();
- // *********************************
-
- // The main window has been initialized, so show and update it.
- pMainFrame->ShowWindow(m_nCmdShow);
- pMainFrame->UpdateWindow();
-
- return TRUE;
- }
-
- // Added these lines to do the splash screen stuff
- // *********************************
- //
- // This function is for the splash window at program startup
- //
- BOOL CTooltestApp::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 > 2000) {
- // timeout expired, destroy the splash window
- m_splash.DestroyWindow();
- m_pMainWnd->UpdateWindow();
-
- // NOTE: don't set bResult to FALSE,
- // CWinApp::OnIdle may have returned TRUE
- }
- else {
- // check again later...
- bResult = TRUE;
- }
- }
-
- return bResult;
- }
-
- BOOL CTooltestApp::PreTranslateMessage(MSG* pMsg)
- {
- BOOL bResult = CWinApp::PreTranslateMessage(pMsg);
-
- if (m_splash.m_hWnd != NULL &&
- (pMsg->message == WM_KEYDOWN ||
- pMsg->message == WM_SYSKEYDOWN ||
- pMsg->message == WM_LBUTTONDOWN ||
- pMsg->message == WM_RBUTTONDOWN ||
- pMsg->message == WM_MBUTTONDOWN ||
- pMsg->message == WM_NCLBUTTONDOWN ||
- pMsg->message == WM_NCRBUTTONDOWN ||
- pMsg->message == WM_NCMBUTTONDOWN)) {
- m_splash.DestroyWindow();
- m_pMainWnd->UpdateWindow();
- }
-
- return bResult;
- }
- // *********************************
-
- /////////////////////////////////////////////////////////////////////////////
- // CTooltestApp commands
- // App command to run the dialog
- void CTooltestApp::OnAppAbout()
- {
- CAboutDlg aboutDlg;
- aboutDlg.DoModal();
- }
-
-