home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / mfc / internet / mfcie / mfcie.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-03-27  |  4.3 KB  |  162 lines

  1. // This is part of the Microsoft Foundation Classes C++ library.
  2. // Copyright (C) 1992-1998 Microsoft Corporation
  3. // All rights reserved.
  4. //
  5. // This source code is only intended as a supplement to the
  6. // Microsoft Foundation Classes Reference and related
  7. // electronic documentation provided with the library.
  8. // See these sources for detailed information regarding the
  9. // Microsoft Foundation Classes product.
  10. //
  11. // mfcie.cpp : Defines the class behaviors for the application.
  12. //
  13.  
  14. #include "stdafx.h"
  15. #include "mfcie.h"
  16.  
  17. #include "MainFrm.h"
  18. #include "mfcieDoc.h"
  19. #include "mfcieVw.h"
  20.  
  21. #ifdef _DEBUG
  22. #define new DEBUG_NEW
  23. #undef THIS_FILE
  24. static char THIS_FILE[] = __FILE__;
  25. #endif
  26.  
  27. /////////////////////////////////////////////////////////////////////////////
  28. // CMfcieApp
  29.  
  30. BEGIN_MESSAGE_MAP(CMfcieApp, CWinApp)
  31.     //{{AFX_MSG_MAP(CMfcieApp)
  32.     ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  33.         // NOTE - the ClassWizard will add and remove mapping macros here.
  34.         //    DO NOT EDIT what you see in these blocks of generated code!
  35.     //}}AFX_MSG_MAP
  36. END_MESSAGE_MAP()
  37.  
  38. /////////////////////////////////////////////////////////////////////////////
  39. // CMfcieApp construction
  40.  
  41. CMfcieApp::CMfcieApp()
  42. {
  43. }
  44.  
  45. /////////////////////////////////////////////////////////////////////////////
  46. // The one and only CMfcieApp object
  47.  
  48. CMfcieApp theApp;
  49.  
  50. /////////////////////////////////////////////////////////////////////////////
  51. // CMfcieApp initialization
  52.  
  53. BOOL CMfcieApp::InitInstance()
  54. {
  55.     if (!AfxSocketInit())
  56.     {
  57.         AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
  58.         return FALSE;
  59.     }
  60.  
  61.     AfxEnableControlContainer();
  62.  
  63.     // Standard initialization
  64.     // If you are not using these features and wish to reduce the size
  65.     //  of your final executable, you should remove from the following
  66.     //  the specific initialization routines you do not need.
  67.  
  68. #ifdef _AFXDLL
  69.     Enable3dControls();         // Call this when using MFC in a shared DLL
  70. #else
  71.     Enable3dControlsStatic();   // Call this when linking to MFC statically
  72. #endif
  73.  
  74.     // Change the registry key under which our settings are stored.
  75.     // You should modify this string to be something appropriate
  76.     // such as the name of your company or organization.
  77.     SetRegistryKey(_T("Local AppWizard-Generated Applications"));
  78.  
  79.     LoadStdProfileSettings(0);  // Load standard INI file options (including MRU)
  80.  
  81.     // Register the application's document templates.  Document templates
  82.     //  serve as the connection between documents, frame windows and views.
  83.  
  84.     CSingleDocTemplate* pDocTemplate;
  85.     pDocTemplate = new CSingleDocTemplate(
  86.         IDR_MAINFRAME,
  87.         RUNTIME_CLASS(CMfcieDoc),
  88.         RUNTIME_CLASS(CMainFrame),       // main SDI frame window
  89.         RUNTIME_CLASS(CMfcieView));
  90.     AddDocTemplate(pDocTemplate);
  91.  
  92.     // Parse command line for standard shell commands, DDE, file open
  93.     CCommandLineInfo cmdInfo;
  94.     ParseCommandLine(cmdInfo);
  95.  
  96.     // Dispatch commands specified on the command line
  97.     if (!ProcessShellCommand(cmdInfo))
  98.         return FALSE;
  99.  
  100.     // The one and only window has been initialized, so show and update it.
  101.     m_pMainWnd->ShowWindow(SW_SHOW);
  102.     m_pMainWnd->UpdateWindow();
  103.  
  104.     return TRUE;
  105. }
  106.  
  107. /////////////////////////////////////////////////////////////////////////////
  108. // CAboutDlg dialog used for App About
  109.  
  110. class CAboutDlg : public CDialog
  111. {
  112. public:
  113.     CAboutDlg();
  114.  
  115. // Dialog Data
  116.     //{{AFX_DATA(CAboutDlg)
  117.     enum { IDD = IDD_ABOUTBOX };
  118.     //}}AFX_DATA
  119.  
  120.     // ClassWizard generated virtual function overrides
  121.     //{{AFX_VIRTUAL(CAboutDlg)
  122.     protected:
  123.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  124.     //}}AFX_VIRTUAL
  125.  
  126. // Implementation
  127. protected:
  128.     //{{AFX_MSG(CAboutDlg)
  129.         // No message handlers
  130.     //}}AFX_MSG
  131.     DECLARE_MESSAGE_MAP()
  132. };
  133.  
  134. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  135. {
  136.     //{{AFX_DATA_INIT(CAboutDlg)
  137.     //}}AFX_DATA_INIT
  138. }
  139.  
  140. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  141. {
  142.     CDialog::DoDataExchange(pDX);
  143.     //{{AFX_DATA_MAP(CAboutDlg)
  144.     //}}AFX_DATA_MAP
  145. }
  146.  
  147. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  148.     //{{AFX_MSG_MAP(CAboutDlg)
  149.         // No message handlers
  150.     //}}AFX_MSG_MAP
  151. END_MESSAGE_MAP()
  152.  
  153. // App command to run the dialog
  154. void CMfcieApp::OnAppAbout()
  155. {
  156.     CAboutDlg aboutDlg;
  157.     aboutDlg.DoModal();
  158. }
  159.  
  160. /////////////////////////////////////////////////////////////////////////////
  161. // CMfcieApp commands
  162.