views:

216

answers:

2

Dear colleagues! Please help me understand what I’m doing wrong!

I have a problem when I programmatically activate my IE toolbar from other program. Making it following the instruction given at Microsoft support site (http://support.microsoft.com/kb/q255920/):

        SHDocVw::IWebBrowser2Ptr pIE;
  HRESULT hr = ::CoCreateInstance(CLSID_InternetExplorer, NULL, 
    CLSCTX_LOCAL_SERVER, IID_IWebBrowser2, (LPVOID*)&pIE);
  if(FAILED(hr)) return;
  try {
   _variant_t vClsID;
   _variant_t vVis;
   _variant_t vNotUsed;

   vClsID.vt = VT_BSTR;
   vClsID.bstrVal = SysAllocString(OLESTR("{MY_TOOLBAR_GUID}"));
   vVis.vt = VT_BOOL;
   vVis.boolVal = VARIANT_TRUE;
   vNotUsed.vt = VT_INT;
   vNotUsed.intVal = 1;

   hr = pIE->ShowBrowserBar()(&vClsID, &vVis, &vNotUsed);
   SysFreeString(vClsID.bstrVal);

   if(FAILED(hr)) return;
  }catch(...) {return;}
pIE->Navigate2(&Url);
pIE->Visible = TRUE;

This code works correctly in IE7, but doesn't work in IE8. In both cases ShowBrowserBar() returns S_OK, but in IE8 toolbar.dll is not loaded into the browser, i.e. the toolbar is not activated and therefore not displayed. I also tried to launch IE8 with three tabs and check if ShowBrowserBar() attempts to open the toolbar in the tabs, not the manager process.

It is log file:

Handle url 'outlook:'
ShowBrowserBar() FAILED!
Handle url 'http://www.handypassword.com'
ShowBrowserBar() SUCCESSED!
Handle url 'http://www.google.ru/'
ShowBrowserBar() SUCCESSED!
Handle url 'http://vkontakte.ru/'
ShowBrowserBar() SUCCESSED!

Everything works as expected in IE7, but not in IE8, and I can't understand why the ShowBrowserBar() method returns S_OK in both of them.

Has anybody got any clues?

Warm regards, Anna.

A: 

Hi Anna :)

Did you find an answer to your problem? I encountered the same problem my self... with no success of solving it, and I saw your post.

Regards, Boaz.

Boaz
Hi, Boaz! I was advised to first hide, and then show toolbar, but it did not help. I could not find the solution :( If you find something interesting, please let me know :)
Anna
A: 

I find an answer of this problem! By default, any add-on or toolbar you install in Internet Explorer will be enabled; but it can later on become disabled  (you can no longer use it), either because you or another Windows user has manually disabled it, or because a third-party installer in conflict automatically disabled it. If user disable toolbar manually you can't show it automatically! You need to re-enable the add-on, in Tools, Manage Add-Ons.

Anna