www.gusucode.com > VC++全局函数实现方法举例源码程序 > VC++全局函数实现方法举例源码程序/code/Globle_Fuction.cpp
// Globle_Fuction.cpp: implementation of the CGloble_Fuction class. // Download by http://www.NewXing.com ////////////////////////////////////////////////////////////////////// #include "stdafx.h" #include "TestGlobal.h" #include "Globle_Fuction.h" #ifdef _DEBUG #undef THIS_FILE static char THIS_FILE[]=__FILE__; #define new DEBUG_NEW #endif ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// CGloble_Fuction::CGloble_Fuction() { m_pMainWnd = NULL; } CGloble_Fuction::~CGloble_Fuction() { } void CGloble_Fuction::MaimMessage(MSG *pMsg) { ASSERT(pMsg); m_pMainWnd->PostMessage(pMsg->message,pMsg->wParam,pMsg->lParam); } void CGloble_Fuction::ViewMessage(MSG *pMsg) { ASSERT(pMsg); m_pMainWnd->GetActiveView()->SendMessage(pMsg->message,pMsg->wParam,pMsg->lParam); } void CGloble_Fuction::DocFution() { AfxMessageBox("在视图上,点左右键,看看!"); } void CGloble_Fuction::Init() { if(!m_pMainWnd) m_pMainWnd = (CMainFrame*)AfxGetMainWnd(); }