我在DLL中作DLG的界面.在界面上作个COMMAND控件---事件是显示AfxMessageBox("hello!");
把DLL注入到目标进程中显示了界面但是按COMMAND时候没有响应事件.
那位大大能告诉我怎么做吗

解决方案 »

  1.   

    also up wait for some one
      

  2.   

    在AfxMessageBox("hello!"); 之前要重设句柄。HINSTANCE hs = AfxGetResourceHandle( );
    AfxSetResourceHandle( dll的HINSTANCE );AfxMessageBox("hello!");AfxSetResourceHandle( hs );
      

  3.   


    #include "stdafx.h"
    #include "Inject.h"
    #include "wgmain.h"
    #ifdef _DEBUG
    #define new DEBUG_NEW
    #undef THIS_FILE
    static char THIS_FILE[] = __FILE__;
    #endif
    HINSTANCE g_hInst;
    这里我声明了g_hInst作为全局的变量但是在对话框里还是说我没有声明
    不知道怎么解决
      

  4.   

    在 theApp里 有hInstance 。 不是自己定义
      

  5.   

    'theApp' : undeclared identifier
      

  6.   

    void wmain::OnButton1() 
    {
    //HINSTANCE g_hInst=this->m_hInstance;

    HINSTANCE hs = AfxGetResourceHandle( );
    AfxSetResourceHandle(theApp->m_hInstance);AfxMessageBox("hello!");AfxSetResourceHandle(hs); 
      

  7.   

    可以直接创建MFC扩展DLL,那样就可以直接用。