我是这样取的:
CMainFrame* pwnd = (CMainFrame*)::AfxGetMainWnd();
在不同的地方调用会出现不同的结果,我估计有些时候返回
的是当前dll的CMainFrame,有些时候返回的是另一个dll中
定义的CMainFrame

解决方案 »

  1.   

    If AfxGetMainWnd is called from the application's primary thread, it returns the application's main window according to the above rules. If the function is called from a secondary thread in the application, the function returns the main window associated with the thread that made the call.
      

  2.   

    就是主线程窗口,看看你的dll是被哪个主线程调用了,但问题是,你怎么获取另外一个dll的CMainFrame,都是同人进程加载的话,怎么会不一样了