Solved

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

Posted on 2002-07-22
8
286 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
  • 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 100 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
 
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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
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…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now