home *** CD-ROM | disk | FTP | other *** search
- // File name: capp.cpp
- //
- // Implementation file for the CApp Class
- //
- // Functions:
- // See capp.h for a list of member functions.
- //
- // Copyright (c) 1996 Microsoft Corporation. All rights reserved.
- //**********************************************************************
- #include <windows.h>
- #include <commctrl.h>
- #include <wininet.h>
-
- #include "comctlhd.h"
- #include "cdlgopt.h"
- #include "cdlg.h"
- #include "capp.h"
- #include "resource.h"
-
-
- CApp FAR * lpCApp;
-
-
- //**********************************************************************
- // WinMain
- //
- // Purpose: Program entry point
- //
- // Parameters:
- // HANDLE hInstance - Instance handle for this instance
- // HANDLE hPrevInstance - Instance handle for the last instance
- // LPSTR lpCmdLine - Pointer to the command line
- // int nCmdShow - Window State
- //
- // Return Value: msg.wParam
- //********************************************************************
- int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow)
-
- {
- MSG msg;
-
- // Create new instance of our application object
- lpCApp = new CApp(hInstance,hPrevInstance,nCmdShow);
-
- if (lpCApp == NULL)
- return FALSE;
-
- if (!lpCApp->InitInstance())
- return FALSE;
-
-
- // message loop
- while (GetMessage(&msg, NULL, 0, 0))
- {
- //should the message be passed on to the dialog
- if (lpCApp->GetHWND() == 0 || !IsDialogMessage(lpCApp->GetHWND(), &msg))
- {
- TranslateMessage(&msg); /* Translates virtual key codes */
- DispatchMessage(&msg); /* Dispatches message to window */
- }
- }
-
-
- // Delete our app object
- delete lpCApp ;
-
- return (msg.wParam); /* Returns the value from PostQuitMessage */
- }
-
-
-
-
- //**********************************************************************
- //
- //CApp::CApp
- //
- // Purpose: Destructor for CApp class
- //
- //Parameters:
- // hInst HINSTANCE from WinMain
- // hPrevInst HINSTANCE from WinMain
- // nCmdShow int from WInMain
- //
- //**********************************************************************
-
-
-
- CApp::CApp(HINSTANCE hInst, HINSTANCE hPrevInst, UINT nCmdShow)
- {
- // Initialize member variables
- m_hInst = hInst;
- m_hInstPrev = hPrevInst;
- m_nCmdShow = nCmdShow;
-
- m_hWnd = NULL;
- m_pCDlgOpt = new CDlgOpt();
-
- }
-
- //**********************************************************************
- // CApp::~CApp
- //
- // Purpose: Destructor for CApp class
- //**********************************************************************
-
- CApp::~CApp()
- {
- delete m_pCDlg;
- delete m_pCDlgOpt;
- return;
- }
-
-
-
- //**********************************************************************
- // CApp::InitInstance
- //
- // Purpose: Instantiate dialog class object and call its initialization
- // function
- // Parameters: None.
- // Return Value:
- // BOOL - TRUE if initialization succeeded, FALSE otherwise.
- //
- //********************************************************************
-
- BOOL CApp::InitInstance()
- {
- m_pCDlg = new CDlg(m_hInst);
-
- // If window could not be created, return "failure"
- if (!m_pCDlg->Init(m_nCmdShow))
- return FALSE;
- m_hWnd = m_pCDlg->GetHWND();
- return TRUE; // We succeeded...
-
- }
-
-
-