开发者

ShowBrowserBar() doesn’t show toolbar in IE8

开发者 https://www.devze.com 2022-12-24 13:54 出处:网络
Please help me understand what I’m doing wrong! I have a problem when I programmatically activate my IE toolbar from other program.

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 t开发者_运维百科o 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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号