我正在尝试向 APPcontainer 注册 BHO。现在根据博客http://blogs.msdn.com/b/ieinternals/archive/2012/03/23/understanding-ie10-enhanced-protected-mode-network-security-插件-cookies-metro-desktop.aspx
,我在与 DLLRegister 相同的 cpp 文件中定义了以下内容
DEFINE_GUID(CATID_AppContainerCompatible, 0x59fb2056,0xd625,0x48d0,0xa9,0x44,0x1a,0x85,0xb5,0xab,0x26,0x40);
STDAPI DllRegisterServer(void)
{
// let ATL handle this
HRESULT hr = _AtlModule.DllRegisterServer();
ICatRegister* pcr = NULL ;
hr = CoCreateInstance(CLSID_StdComponentCategoriesMgr, NULL, CLSCTX_INPROC_SERVER, IID_ICatRegister, (void**)&pcr);
if (FAILED(hr))
return hr;
if (SUCCEEDED(hr))
{
// Register this category as being "implemented" by
// the class.
CATID rgcatid[1] ;
rgcatid[0] = CATID_AppContainerCompatible;
hr = pcr->RegisterClassImplCategories(CLSID_ABC, 1, rgcatid);
}
当我尝试编译此代码时,出现以下错误:
unresolved external symbol CATID_AppContainerCompatible
不知道为什么会这样。我可以通过右键单击它导航到 CATID_AppContainerCompatible 定义。有什么建议吗??
我解决了这个问题。由于 DEFINE_GUID 将 GUID 声明为 extern 我需要放入const GUID CATID_AppContainerCompatible ;
我的文件中。在放入该语句后进行编译。