0

I use Microsoft Visual C++ and Windows 7.
I am developing IE toolbar with ATL and MFC. IE version is 11.0.9600.17420.

First of all, I have created COM object implementing IDeskBand and IObjectWithSite interfaces.
Second, I have implemented IDeskBand methods and IObjectWithSite::SetSite method. It takes only one parameter, IUnknown *pUnkSite.

As I remember, I can do pUnkSite->QueryInterface(IID_IOleWindow, (void**)&pOleWindow); to get IOleWindow interface from site, and then I can call pOleWindow->GetWindow(&hWnd); to get parent window handle; so I can create my toolbar window as a child of window with this hWnd.

So I did it and realized that pUnkSite->QueryInterface(IID_IOleWindow, (void**)&pOleWindow); returns 0x80004002 which is E_NOINTERFACE error, so IOleWindow is not implemented by pUnkSite object! I opened IE in debugger, loaded symbols, traced to QISearch and realized that there is no implementation of IOleWindow interface. If I am not mistaken it was CIEFrameAuto interface.

So, how can I obtain IOleWindow interface for parent window for my toolbar?

cls
  • 501
  • 1
  • 5
  • 18
  • Is it a BHO, or a toolbar? The title says the former, but the content the latter. How did you register your object? See also: https://msdn.microsoft.com/en-us/library/bb776819.aspx – Igor Tandetnik Jul 30 '16 at 17:43
  • @IgorTandetnik OK, now I register it only on HKLM\Software\Microsoft\Internet Explorer\Toolbar and not as BHO. But my `SetSite()` method is not called now! – cls Jul 31 '16 at 06:01
  • Newly registered toolbars are off by default. Right-click the title of IE window, see if your toolbar shows up in the menu. If so, enable it there. – Igor Tandetnik Jul 31 '16 at 13:29
  • @IgorTandetnik i did it of course. It waits some time then asks if I want to disable this extension. Toolbar name is showed in the context menu. No `OutputDebugString()` in `SetSite()` nor `__asm int 3` after debug string output happen. – cls Jul 31 '16 at 21:11
  • Well, you must be doing something wrong, but it's hard to see what without seeing the code. Try to figure out where the process fails. Does your DLL get loaded? Is `DllGetClassObject` called? Is `IClassFactory::CreateInstance` called, and if so, which interface is being requested? Is `QueryInterface` called on the object that `CreateInstance` creates, and if so, which interfaces are being queried? – Igor Tandetnik Jul 31 '16 at 23:33
  • @IgorTandetnik DLL gets loaded. `DllGetClassObject` is called. `IClassFactory::CreateInstance()` is called - and it queries `IDeskBand2`, right, it is not implemented. In which version of IE it started to create `IDeskBand2` instance instead of `IDeskBand`? – cls Aug 01 '16 at 11:57
  • @IgorTandetnik also I want my toolbar to be compatible with all IE version starting with IE7. Is it enough to implement `IDeskBand2` interface only? – cls Aug 01 '16 at 11:58
  • Seeing is `IDeskBand2` derives from `IDeskBand`, you would necessarily implement both anyway. As to which version started requiring `IDeskBand2` - no idea, sorry. I last implemented an IE toolbar circa 2005, when IE6 was the new shiny. – Igor Tandetnik Aug 01 '16 at 13:13
  • @IgorTandetnik thank you. All is working perfect now. – cls Aug 02 '16 at 01:52

0 Answers0