以文本方式查看主题

-  中文XML论坛 - 专业的XML技术讨论区  (http://bbs.xml.org.cn/index.asp)
--  『 C/C++编程思想 』  (http://bbs.xml.org.cn/list.asp?boardid=61)
----  如何通过VC++来实现类与类之间的函数调用?  (http://bbs.xml.org.cn/dispbbs.asp?boardid=61&rootid=&id=89094)


--  作者:葛靖青001
--  发布时间:1/11/2011 3:51:00 PM

--  如何通过VC++来实现类与类之间的函数调用?
【转自互联网】


GET App

  、、、、、AfxGetInstanceHandle()

  、、、、、AfxGetApp()

  GET Frame->View->Document

  、、、、、SDI AfxGetMainWnd() -> GetActiveView() -> GetDocument()

  、、、、、MDI AfxGetMainWnd() -> MDIGetActive() -> GetActiveView() -> GetDocument()

  GET Menu

  、、、、、CMenu *pMenu=AfxGetApp()->m_pMainWnd->GetMenu();

  GET ToolBar,StatusBar

  、、、、、(CMainFrame *)GetParent()->m_wndToolBar;

  、、、、、(CMainFrame *)GetParent()->m_wndStatusBar;

  、、、、、CStatusBar * pStatusBa=(CStatusBar *)AfxGetMainWnd()->GetDescendantWindow(AFX_IDW_STATUS_BAR);

  、、、、、CToolBar * pToolBar=(CtoolBar *)AfxGetMainWnd()->GetDescendantWindow(AFX_IDW_TOOLBAR);

  Get View from Document

  、、、、、GetFirstViewPosition 和 GetNextView 函数得到指针。

  最后提醒:

  、、、、、在提取到各个句柄之后,因为初次提取的都是标准类句柄,所以,在使用时要注意将标准句柄转换成自己的类的句柄。

  、、、、、((CMyApp*)AfxGetApp())->XXXX();//这的xxxx()就是你定义的类中间的成员


W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
19.531ms