📄 hoopstest.cpp
字号:
// ChoopstestApp.cpp : Defines the class behaviors for the application.//#include "StdAfx.h"#include "Resource.h"#include "hoopstest.h"#include "hoopstestDoc.h"#include "hoopstestView.h"#include "MainFrm.h"#include "HhoopstestView.h"#include "HDB.h"#include "CTDriver.h"// HNet integration#include "NetworkDlg.h"#include "HNetMgr.h"// HOOPS-bridge#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE[] = __FILE__;#endif/////////////////////////////////////////////////////////////////////////////// ChoopstestAppBEGIN_MESSAGE_MAP(ChoopstestApp, CHoopsApp) //{{AFX_MSG_MAP(ChoopstestApp) ON_COMMAND(ID_APP_ABOUT, OnAppAbout) ON_COMMAND(ID_FILE_NETWORK, OnFileNetwork) //}}AFX_MSG_MAPEND_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////// ChoopstestApp constructionChoopstestApp::ChoopstestApp(){// HC_Define_System_Options("no warnings, no info, no errors, no message limit"); m_pHoopsDB = NULL; m_pCTDriver = NULL; m_pNetworkDlg = 0;}/////////////////////////////////////////////////////////////////////////////// The one and only ChoopstestApp objectChoopstestApp theApp;/////////////////////////////////////////////////////////////////////////////// ChoopstestApp initializationBOOL ChoopstestApp::InitInstance(){ m_pHoopsDB = new HDB; m_pHoopsDB->Init(); //m_pCTDriver must be started after m_pHoopsDB is created m_pCTDriver = new CTDriver( 10 ); m_pCTDriver->StartTimer(); // Standard initialization // If you are planning to use this source code in Visual Studio 6.0 or // earlier versions, you should uncomment the following//#ifdef _AFXDLL// Enable3dControls(); // Call this when using MFC in a shared DLL//#else// Enable3dControlsStatic(); // Call this when linking to MFC statically//#endif 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. CSingleDocTemplate* pDocTemplate; pDocTemplate = new CSingleDocTemplate(// IDR_HOOPSTYPE, IDR_MAINFRAME, RUNTIME_CLASS(ChoopstestDoc), RUNTIME_CLASS(CMainFrame), // child frame RUNTIME_CLASS(ChoopstestView)); AddDocTemplate(pDocTemplate); // Enable DDE Execute open EnableShellOpen(); RegisterShellFileTypes(TRUE); // Parse command line for standard shell commands, DDE, file open CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); // Dispatch commands specified on the command line if (!ProcessShellCommand(cmdInfo)) return FALSE; // The main window has been initialized, so show and update it. m_pMainWnd->ShowWindow(SW_SHOWMAXIMIZED); m_pMainWnd->UpdateWindow(); // Enable drag/drop open m_pMainWnd->DragAcceptFiles(); //模拟一次 login#ifndef _DEBUG m_pMainWnd->PostMessage(WM_COMMAND,ID_LOGIN,0);#endif return TRUE;}/////////////////////////////////////////////////////////////////////////////// CAboutDlg dialog used for App Aboutclass CAboutDlg : public CDialog{public: CAboutDlg();// Dialog Data enum { IDD = IDD_ABOUTBOX };protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support// Implementationprotected: DECLARE_MESSAGE_MAP()};CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD){}void CAboutDlg::DoDataExchange(CDataExchange* pDX){ CDialog::DoDataExchange(pDX);}BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)END_MESSAGE_MAP()// App command to run the dialogvoid ChoopstestApp::OnAppAbout(){ CAboutDlg aboutDlg; aboutDlg.DoModal();}/////////////////////////////////////////////////////////////////////////////// CHoopsApp commandsint ChoopstestApp::ExitInstance() { // get rid of the HNet dialog if we have one if( m_pNetworkDlg ) { delete m_pNetworkDlg; m_pNetworkDlg = 0; } //m_pCTDriver must be deleted before m_pHoopsDB if (m_pCTDriver) { delete m_pCTDriver; m_pCTDriver = NULL; } if (m_pHoopsDB) { delete m_pHoopsDB; m_pHoopsDB = 0; } return CHoopsApp::ExitInstance();}//======================================================================// Function : ChoopstestApp::OnFileNetwork// Description : Creates a network dialog if not present. Restores it// if it is already present// Return :void - // Parameters :// Note ://======================================================================void ChoopstestApp::OnFileNetwork() { // create a new network dialog if we don't have it yet if( !m_pNetworkDlg ) { m_pNetworkDlg = new CNetworkDlg(); m_pNetworkDlg->Create(IDD_NETWORKDIALOG); m_pNetworkDlg->ShowWindow(SW_SHOW); } else // just restore the dialog m_pNetworkDlg->ShowWindow(SW_SHOWNORMAL);}//======================================================================// Function : ChoopstestApp::GetHNetMgr// Description : returns the HNetMgr object from the network dlg// Return :HNetMgr* - // Parameters :// Note ://======================================================================HNetMgr* ChoopstestApp::GetHNetMgr(){ assert( m_pNetworkDlg ); if( m_pNetworkDlg ) return m_pNetworkDlg->GetHNetMgr(); else return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -