views:

49

answers:

1

When I run this code on IE8, ShowBrowserBar returns S_OK, but the toolbar isn't shown. On IE7 it works fine. I saw a similar question here, by Anna, but without a working answer... :) Any suggestions?

int _tmain(int argc, _TCHAR* argv[])
{
   CoInitialize(0);
   IWebBrowser2 *pIE = NULL;

   // Create an instance of Internet Explorer
   HRESULT hr = CoCreateInstance(CLSID_InternetExplorer, NULL, CLSCTX_SERVER,       IID_IWebBrowser2, (void**)&pIE);
   if (FAILED(hr)) {
      return 1;
   }

   if( pIE != NULL ) {
      VARIANT vtBandGUID, vtShow, vtSize;
      vtBandGUID.vt = VT_BSTR;
      vtBandGUID.bstrVal = SysAllocString( L"{my-toolbar-guid}" );

      vtShow.vt = VT_BOOL;
      vtShow.boolVal = VARIANT_TRUE;
      vtSize.vt = VT_I2;
      vtSize.iVal = 0;

      HRESULT hr = pIE->ShowBrowserBar( &vtBandGUID, &vtShow, &vtSize );
      SysFreeString( vtBandGUID.bstrVal );
      pIE->Release();
   }
   CoUninitialize();
   return 0;
}
A: 

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