Reputation: 11
I'm trying to design a toolbar for IE. I've successfully compiled the 32-bit and 64-bit versions of the toolbar and both are working as expected on IE9. But when I try it on IE10 on Windows 8, the toolbar is not getting loaded. IE is able to see the toolbar in Manage Addons and it is enabled over there for 32 and 64 bit. But it is not loading. I've even placed an alert box in DllMain method, but even that's not there. In my plugin, I've added the statement described on IEInternals Blog:
DEFINE_GUID(CATID_AppContainerCompatible, 0x59fb2056,0xd625,0x48d0,0xa9,0x44,0x1a,0x85,0xb5,0xab,0x26,0x40);
What else am I missing?
Upvotes: 1
Views: 921
Reputation: 160
You need to include "IEPMapi.h"
IEMapi.h ships with Windows SDK Windows 8.1 SDK
then you need function like this that gets called by DllRegisterServer so when your dll gets invoked by regsvr32 it marks the comptabile category under your toolbar class-id under registry HKEY_CLASS_ROOT
bool RegisterCLSIDInCategory(REFCLSID clsID)
{
CComPtr<ICatRegister> catRegister = NULL ;
HRESULT hr = ::CoCreateInstance(CLSID_StdComponentCategoriesMgr,
NULL,
CLSCTX_INPROC_SERVER,
IID_ICatRegister,
(void**)&catRegister);
if (SUCCEEDED(hr))
{
// Register this category as being "implemented" by
// the class.
CATID rgcatid[] ={ CATID_AppContainerCompatible};
HRESULT hr2 = catRegister->RegisterClassImplCategories(clsID, 1, rgcatid);
if (SUCCEEDED(hr2))
{
return true;
}
}
return false;
}
Upvotes: 0
Reputation: 57085
The DEFINE_GUID call simply defines the GUID value constant in your code, it's not actually doing anything to register your object with the COM component category (which is stored in the registry).
See http://msdn.microsoft.com/en-us/library/windows/desktop/ms692551(v=vs.85).aspx and http://msdn.microsoft.com/en-us/library/windows/desktop/ms694322(v=vs.85).aspx
You can see which objects are registered into the various categories using the OLEView tool.
Also, be sure to place your BHO's DLL with an AppContainer-readable folder (e.g. a subfolder of the \Program Files\ folder). If you fail to do so, your DLL will not be loaded by the IE instance in Enhanced Protected Mode.
Upvotes: 1