Billiards.cpp
上传用户:sycq158
上传日期:2008-10-22
资源大小:15361k
文件大小:3k
源码类别:

游戏

开发平台:

Visual C++

  1. // Billiards.cpp : Defines the class behaviors for the application.
  2. //
  3. #include "stdafx.h"
  4. #include "Billiards.h"
  5. #include "MainFrm.h"
  6. #include "BilliardsDoc.h"
  7. #include "BilliardsView.h"
  8. #include "Splash.h"
  9. #include "WizardDlg.h"
  10. #ifdef _DEBUG
  11. #define new DEBUG_NEW
  12. #undef THIS_FILE
  13. static char THIS_FILE[] = __FILE__;
  14. #endif
  15. /////////////////////////////////////////////////////////////////////////////
  16. // CBilliardsApp
  17. BEGIN_MESSAGE_MAP(CBilliardsApp, CWinApp)
  18. //{{AFX_MSG_MAP(CBilliardsApp)
  19. ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  20. //}}AFX_MSG_MAP
  21. // Standard file based document commands
  22. ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
  23. ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
  24. // Standard print setup command
  25. ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
  26. END_MESSAGE_MAP()
  27. /////////////////////////////////////////////////////////////////////////////
  28. // CBilliardsApp construction
  29. CBilliardsApp::CBilliardsApp()
  30. {
  31. // TODO: add construction code here,
  32. // Place all significant initialization in InitInstance
  33. }
  34. CBilliardsApp theApp;
  35. BOOL CBilliardsApp::InitInstance()
  36. {
  37. { CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); CSplashWnd::EnableSplashScreen(cmdInfo.m_bShowSplash); }
  38. AfxEnableControlContainer();
  39. #ifdef _AFXDLL
  40. Enable3dControls(); // Call this when using MFC in a shared DLL
  41. #else
  42. Enable3dControlsStatic(); // Call this when linking to MFC statically
  43. #endif
  44. SetRegistryKey(_T("Local AppWizard-Generated Applications"));
  45. LoadStdProfileSettings();  // Load standard INI file options (including MRU)
  46. CSingleDocTemplate* pDocTemplate;
  47. pDocTemplate = new CSingleDocTemplate(
  48. IDR_MAINFRAME,
  49. RUNTIME_CLASS(CBilliardsDoc),
  50. RUNTIME_CLASS(CMainFrame),       // main SDI frame window
  51. RUNTIME_CLASS(CBilliardsView));
  52. AddDocTemplate(pDocTemplate);
  53. CCommandLineInfo cmdInfo;
  54. ParseCommandLine(cmdInfo);
  55. if (!ProcessShellCommand(cmdInfo))
  56. return FALSE;
  57.     
  58. m_pMainWnd->CenterWindow();
  59.     m_pMainWnd->ShowWindow(SW_SHOW);
  60. m_pMainWnd->UpdateWindow();
  61.     m_pMainWnd->SetWindowText("Billiards");
  62.     
  63.     
  64.     if (!AfxSocketInit())
  65. {
  66. AfxMessageBox("Socket initalize failed!");
  67. return FALSE;
  68. }
  69. return TRUE;
  70. }
  71. /////////////////////////////////////////////////////////////////////////////
  72. // CAboutDlg dialog used for App About
  73. class CAboutDlg : public CDialog
  74. {
  75. public:
  76. CAboutDlg();
  77. // Dialog Data
  78. //{{AFX_DATA(CAboutDlg)
  79. enum { IDD = IDD_ABOUTBOX };
  80. //}}AFX_DATA
  81. // ClassWizard generated virtual function overrides
  82. //{{AFX_VIRTUAL(CAboutDlg)
  83. protected:
  84. virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  85. //}}AFX_VIRTUAL
  86. // Implementation
  87. protected:
  88. //{{AFX_MSG(CAboutDlg)
  89. //}}AFX_MSG
  90. DECLARE_MESSAGE_MAP()
  91. };
  92. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  93. {
  94. //{{AFX_DATA_INIT(CAboutDlg)
  95. //}}AFX_DATA_INIT
  96. }
  97. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  98. {
  99. CDialog::DoDataExchange(pDX);
  100. //{{AFX_DATA_MAP(CAboutDlg)
  101. //}}AFX_DATA_MAP
  102. }
  103. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  104. //{{AFX_MSG_MAP(CAboutDlg)
  105. //}}AFX_MSG_MAP
  106. END_MESSAGE_MAP()
  107. void CBilliardsApp::OnAppAbout()
  108. {
  109. CAboutDlg aboutDlg;
  110. aboutDlg.DoModal();
  111. }
  112. BOOL CBilliardsApp::PreTranslateMessage(MSG* pMsg)
  113. {
  114. // CG: The following lines were added by the Splash Screen component. if (CSplashWnd::PreTranslateAppMessage(pMsg)) return TRUE; return CWinApp::PreTranslateMessage(pMsg);
  115. }