BOOL CDemoApp::InitInstance()
{
CoInitialize(NULL); InitCommonControls();
CWinApp::InitInstance(); // 初始化 OLE 库
if (!AfxOleInit())
{
AfxMessageBox(IDP_OLE_INIT_FAILED);
return FALSE;
}
...
}
编译错误提示:Demo.cpp(63) : error C2065: 'IDP_OLE_INIT_FAILED' : undeclared identifier
Error executing cl.exe.
为什么IDP_OLE_INIT_FAILED是未定义的标识符呢...
{
CoInitialize(NULL); InitCommonControls();
CWinApp::InitInstance(); // 初始化 OLE 库
if (!AfxOleInit())
{
AfxMessageBox(IDP_OLE_INIT_FAILED);
return FALSE;
}
...
}
编译错误提示:Demo.cpp(63) : error C2065: 'IDP_OLE_INIT_FAILED' : undeclared identifier
Error executing cl.exe.
为什么IDP_OLE_INIT_FAILED是未定义的标识符呢...
这句去掉。因为AfxOleInit里面会执行类似CoInitialize(NULL);的功能。
而且会判断是否已经执行了CoInitialize(NULL);一判断有,就返回0
我做的时候没调其他的函数,这样就可以啊
//初始化OLE DLLs
if (!AfxOleInit())
{
AfxMessageBox("初始化OLE DLLs失败!");
return FALSE;
}
//要看代码和版本