Solved

ShellExecute to launch a Web Browser

Posted on 1998-03-26
5
517 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
  • 3
  • 2
5 Comments
 
LVL 23

Accepted Solution

by:
chensu earned 50 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Hmmmm, ok! Thanks a lot, I'll give this a shot ;)

0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
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 seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

762 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

12 Experts available now in Live!

Get 1:1 Help Now