如何在dll中取得CWinApp对象

lutong 2004-04-03 12:38:26
我的主程序是用MFC做的,想在dll中用AfxGetApp()取得app对象,发现都是空值,有没有办法?
...全文
42 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
dafan 2004-04-03
  • 打赏
  • 举报
回复
你去debug一下,看看到底是哪里出了差错!我现在给你一点提示
MFC Library Reference

AfxGetApp See Also
MFC Macros and Globals
The pointer returned by this function can be used to access application information such as the main message-dispatch code or the topmost window.

CWinApp* AFXAPI AfxGetApp( );
Return Value
A pointer to the single CWinApp object for the application.

Example
// Print the application's executable filename.
TRACE("Executable filename = %s\n", AfxGetApp()->m_pszExeName);

See Also
MFC Macros and Globals

^_^,就是这样的简单!
zhangcrony 2004-04-03
  • 打赏
  • 举报
回复
Not clear enough...

15,471

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 进程/线程/DLL
社区管理员
  • 进程/线程/DLL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧