2

我正在尝试创建一个 shell 扩展,但在这行代码中我得到了一个调试断言:

_AFXWIN_INLINE HINSTANCE AFXAPI AfxGetResourceHandle()
    { 
        ASSERT(afxCurrentResourceHandle != NULL);  // here
        return afxCurrentResourceHandle; }

它有什么问题?我创建了这个类

class CMyExtShellExtApp : public CWinApp
{
public:
    virtual BOOL InitInstance();
    virtual int ExitInstance();

    DECLARE_MESSAGE_MAP()
};

BOOL CMyExtShellExtApp::InitInstance()
{   
    AFX_MANAGE_STATE(AfxGetStaticModuleState());
    return CWinApp::InitInstance();
}

int CMyExtShellExtApp::ExitInstance()
{
    return CWinApp::ExitInstance();
}

错误仍然存​​在。

4

1 回答 1

4

试着把这一行:

AFX_MANAGE_STATE(AfxGetStaticModuleState());

在函数的开头导致代码中的断言。

于 2012-11-13T09:14:38.400 回答