GameHigh.cpp
上传用户:swkcbjrc
上传日期:2016-04-02
资源大小:45277k
文件大小:4k
源码类别:

游戏

开发平台:

Visual C++

  1. // GameHigh.cpp : Defines the class behaviors for the application.
  2. //
  3. #include "stdafx.h"
  4. #include "GameHigh.h"
  5. #include "MainFrm.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // CGameHighApp
  13. BEGIN_MESSAGE_MAP(CGameHighApp, CWinApp)
  14. //{{AFX_MSG_MAP(CGameHighApp)
  15. ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  16. // NOTE - the ClassWizard will add and remove mapping macros here.
  17. //    DO NOT EDIT what you see in these blocks of generated code!
  18. //}}AFX_MSG_MAP
  19. END_MESSAGE_MAP()
  20. /////////////////////////////////////////////////////////////////////////////
  21. // CGameHighApp construction
  22. CGameHighApp::CGameHighApp()
  23. {
  24. // TODO: add construction code here,
  25. // Place all significant initialization in InitInstance
  26. pMainData =NULL;
  27. }
  28. /////////////////////////////////////////////////////////////////////////////
  29. // The one and only CGameHighApp object
  30. CGameHighApp theApp;
  31. /////////////////////////////////////////////////////////////////////////////
  32. // CGameHighApp initialization
  33. BOOL CGameHighApp::InitInstance()
  34. {
  35. // Standard initialization
  36. // If you are not using these features and wish to reduce the size
  37. //  of your final executable, you should remove from the following
  38. //  the specific initialization routines you do not need.
  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. // Change the registry key under which our settings are stored.
  45. // TODO: You should modify this string to be something appropriate
  46. // such as the name of your company or organization.
  47. SetRegistryKey(_T("Local AppWizard-Generated Applications"));
  48. m_FaceList.Init();
  49. if(NULL == pMainData)
  50. {
  51. pMainData =new CMainData();
  52. }
  53. ASSERT(pMainData);
  54. if(NULL == pMainData)
  55. {
  56. return FALSE;
  57. }
  58. CLoginDlg m_LoginDlg;
  59. if(IDOK != m_LoginDlg.DoModal())
  60. {
  61. ::PostQuitMessage(0);
  62. return FALSE;
  63. }
  64. //提取军棋Dll
  65. hJQLib =::LoadLibrary("jq.dll");
  66. CString strUser =m_LoginDlg.GetUser();
  67. CString strPass =m_LoginDlg.GetPass();
  68. // To create the main window, this code creates a new frame window
  69. // object and then sets it as the application's main window object.
  70. CMainFrame* pFrame = new CMainFrame(strUser, strPass);
  71. m_pMainWnd = pFrame;
  72. // The one and only window has been initialized, so show and update it.
  73. pFrame->ShowWindow(SW_SHOWMAXIMIZED);
  74. pFrame->UpdateWindow();
  75. return TRUE;
  76. }
  77. CFaceList* gpFaceList =theApp.GetFaceList();
  78. CMainData* gpMainData =theApp.GetMainData();
  79. /////////////////////////////////////////////////////////////////////////////
  80. // CGameHighApp message handlers
  81. /////////////////////////////////////////////////////////////////////////////
  82. // CAboutDlg dialog used for App About
  83. class CAboutDlg : public CDialog
  84. {
  85. public:
  86. CAboutDlg();
  87. // Dialog Data
  88. //{{AFX_DATA(CAboutDlg)
  89. enum { IDD = IDD_ABOUTBOX };
  90. //}}AFX_DATA
  91. // ClassWizard generated virtual function overrides
  92. //{{AFX_VIRTUAL(CAboutDlg)
  93. protected:
  94. virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  95. //}}AFX_VIRTUAL
  96. // Implementation
  97. protected:
  98. //{{AFX_MSG(CAboutDlg)
  99. // No message handlers
  100. //}}AFX_MSG
  101. DECLARE_MESSAGE_MAP()
  102. };
  103. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  104. {
  105. //{{AFX_DATA_INIT(CAboutDlg)
  106. //}}AFX_DATA_INIT
  107. }
  108. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  109. {
  110. CDialog::DoDataExchange(pDX);
  111. //{{AFX_DATA_MAP(CAboutDlg)
  112. //}}AFX_DATA_MAP
  113. }
  114. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  115. //{{AFX_MSG_MAP(CAboutDlg)
  116. // No message handlers
  117. //}}AFX_MSG_MAP
  118. END_MESSAGE_MAP()
  119. // App command to run the dialog
  120. void CGameHighApp::OnAppAbout()
  121. {
  122. CAboutDlg aboutDlg;
  123. aboutDlg.DoModal();
  124. }
  125. /////////////////////////////////////////////////////////////////////////////
  126. // CGameHighApp message handlers
  127. CFaceList* CGameHighApp::GetFaceList()
  128. {
  129. return &m_FaceList;
  130. }
  131. int CGameHighApp::ExitInstance() 
  132. {
  133. SAFE_CHECKPOINTER(pMainData)
  134. {
  135. delete pMainData;
  136. pMainData =NULL;
  137. }
  138. SAFE_CHECKPOINTER(hJQLib)
  139. {
  140. ENDMODUAL endmodual=(ENDMODUAL)GetProcAddress(hJQLib, "EndModal");
  141. if(NULL != endmodual)
  142. {
  143. endmodual();
  144. }
  145. ::FreeLibrary(hJQLib);
  146. }
  147. return CWinApp::ExitInstance();
  148. }
  149. CMainData* CGameHighApp::GetMainData()
  150. {
  151. return pMainData;
  152. }