Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Add a button to IE's Toolbar to navigate http://somewhere?

Posted on 2002-07-22
8
Medium Priority
?
292 Views
Last Modified: 2013-12-03
After i installed some software,it can add a button to IE's standard button bar.Once i click the button ,my IE would go to the software's homepage.

I searched in Regedit,i found this key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Extensions

Now i can add a button to run a EXE file,but how to let it navigate a specified URL,such as http://www.yahoo.com?

Thanks!
0
Comment
Question by:Conwood
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +2
8 Comments
 
LVL 2

Expert Comment

by:SChertkov
ID: 7171028
You must create small COM object that implements
interface  IOleCommandTarget (and optionally IObjectWithSite for access to DHTML) and register
it in HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Extensions\

For details referer to MSDN for additional details

http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/ext/tutorials/button.asp

0
 
LVL 9

Accepted Solution

by:
BeyondWu earned 300 total points
ID: 7173604
To do this, you need to implement IObjectWithSite interface. In the IObjectWithSite::SetSite(IUnknown* pUnkSite), IE will input an interface, you can get IWebBrowser2 from this interface, then call IWebBrowser2::Navigate(URL,...
#include <atlbase.h>
CYourExplorerButton::SetSite(IUnknown* punkSite)
{
   CComQIPtr<IWebBrowser2, &IID_IWebBrowser2> spWebBrowser2;
   // Query pUnkSite for the IWebBrowser2 interface.
   m_spWebBrowser2 = pUnkSite;

   // navigate to any URL
   CComBSTR bstrURL(szURL);
   CComVariant vtEmpty;

   spWebBrowser2->Navigate(bstrURL, &vtEmpty, &vtEmpty, &vtEmpty, &vtEmpty);
   // ...
}
0
 
LVL 2

Expert Comment

by:SChertkov
ID: 7173639
You code will navigate to URL every time when call
IObjectWithSite::SetSite from browser. I think every time
when browser open.

spWebBrowser2->Navigate must calling in
IOleCommandTarget::Exec
0
Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

 
LVL 1

Expert Comment

by:Jenn050402
ID: 7174381
Conwood,
See if this helps...

See this site for how IE's toolbar buttons are constructed and behave:
http://msdn.microsoft.com/workshop/browser/ext/tutorials/button.asp
http://msdn.microsoft.com/workshop/browser/ext/overview/toolbar_style.asp

Jenn

0
 
LVL 9

Expert Comment

by:BeyondWu
ID: 7176016
SChertkov, you are right,
Conwood, I made a mistake.
At the CYourExplorerButton::SetSite(IUnknown* punkSite), you should save the IWebBrowser2 interface, and in IOleCommandTarget::Exec, you can call spWebBrowser2->Navigate(bstrURL, &vtEmpty, &vtEmpty, &vtEmpty, &vtEmpty);

#include <atlbase.h>
// please add the spWebBrowser2 into your class as a data member.
// so just as a global variable.
CComQIPtr<IWebBrowser2, &IID_IWebBrowser2> spWebBrowser2;

CYourExplorerButton::SetSite(IUnknown* punkSite)
{
  // Query pUnkSite for the IWebBrowser2 interface.
  // and save it.
  m_spWebBrowser2 = pUnkSite;
  // ...
}

CYourExplorerButton::Exec(...)
{
  // navigate to any URL
  CComBSTR bstrURL(szURL);
  CComVariant vtEmpty;

  spWebBrowser2->Navigate(bstrURL, &vtEmpty, &vtEmpty, &vtEmpty, &vtEmpty);
  // ...
}


0
 

Author Comment

by:Conwood
ID: 7176039
Thanks all.
I'm busy with exams these days , so perhaps I have to try your method some days later.

Another question:how I can i give 200 marks to you three?
I mean , for example : give one 100 , another 50 , another 50.
0
 
LVL 1

Expert Comment

by:Jenn050402
ID: 7177585
You can post a message in community support saying you want your points refunded because you want to split them.
Then post a "points for ..." question in the Windows Programming area for the users you want the points to go to worth how many points you want to give each. When the user posts an answer (just something saying "thanks for the points..." you accept answer.

 
0
 
LVL 1

Expert Comment

by:Computer101
ID: 7183369
Points have been reduced to 100 and the remaining 100 refunded to you.  Now you can accept a comment from one expert.  After that, make another question in this topic area for the other expert.

Compmuter101
E-E Moderator
0

Featured Post

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
This article surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question