?
Solved

ShellExecute to launch a Web Browser

Posted on 1998-03-26
5
Medium Priority
?
535 Views
Last Modified: 2013-12-03
I'm using ShellExecute() to load the users default browser when the user chooses to view my help file system in my application.Currently, I pass in the name of the file to launch into the browser, but thats not quite as well as I would like it. In addition to loading the html file, I'd also like it to go to a specific anchor; ie: sample.html
0
Comment
Question by:gunn
[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
  • 3
  • 2
5 Comments
 
LVL 23

Accepted Solution

by:
chensu earned 50 total points
ID: 1412303
Use FindExecutable() function to get the exe full path name of the default browser. Then, you can use ShellExecute() to specify the exe and the HTML filename with #Anchor as the parameter.

For example, the parameters for ShellExecute(),

lpFile: "C:\Program Files\Internet Explorer\Iexplore.exe"  found by FindExecutable().
lpParameters: "C:\INetSDK\Help\inet0257.htm#ratings_040f000103000000".
0
 

Author Comment

by:gunn
ID: 1412304
Thanks a lot, that worked. I hope you can add a comment here for a problem that I found due to this result though...



When I pick the help from the menu the first time, it loads the browser and page at the right anchor. However, if I go through my application, say to another window and choose help on that window  (a new page and new anchor), I get a brand new browser to launch with this info. So now I have 2 browsers open. I'd like for it to load the new page into the already opened browser...and I can't figure out how to do this?



Thanks again for the help
0
 
LVL 23

Expert Comment

by:chensu
ID: 1412305
I cannot think of an easy way to do so. Take a look at the following Microsoft KB articles:
Article ID: Q160976  HOWTO: Controlling the Currently Running Instance of IE3 via DDE
Article ID: Q176792  HOWTO: Connecting to a Running Instance of Internet Explorer
0
 
LVL 23

Expert Comment

by:chensu
ID: 1412306
I have just thought of an easy way to do so. You can create a temporary URL shortcut containing the URL with an anchor and use ShellExecute to execute the shortcut. This might work. A URL shortcut is simply a text file like the following:

[InternetShortcut]
URL=http://www.experts-exchange.com/Q.10044944#anchor

0
 

Author Comment

by:gunn
ID: 1412307
Hmmmm, ok! Thanks a lot, I'll give this a shot ;)

0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
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 brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

752 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