• Advertisement
Sign in to follow this  

ShellExecute for launching URL in Default Browser

This topic is 4255 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I was looking for a way to launch websites in windows' default internet browser and ShellExecute seemed like the best solution. I wrote a line that looks exactly like this. ShellExecute(NULL, "open", "http://www.gamedev.com", NULL, NULL, SW_SHOWNORMAL); Unfortunately, it returns error code 5, which means "Attempt was made to dynamically link to a task, or there was a sharing or network-protection error." I can shell other programs on my machine, and use the function to open text files and whatnot using default programs... So the command does function. I found a Microsoft Support article telling me that this is exactly the way to do it. I am using Microsoft Visual Studio .NET 2003 pro, windows XP, and have tried both opera and firefox as default browsers to see if that was the problem. In case it matters, The shellexecute command in my app is contained within a function deep in a dll, which is called from a win32 exe. Thank you in advance.. I'm sure someone has come across this problem, and the most similar post to date didn't help.

Share this post


Link to post
Share on other sites
Advertisement
I had the same problem after installing and uninstalling some browsers. My default browser was set to a nonexistent executable file.

Bring up a Windows Explorer window and go to Tools/Folder Options/File Types. Find '(NONE) URL:HyperText Transfer Protocol' in the list, select it and click 'Advanced'. This will bring up a list of actions. There should be a single action called 'open'. Choose 'open' and click the edit button, and see if the settings look right.

(For what it's worth, I currently have it set to 'c:\progra~1\opera\Opera.exe "%1"'.)

Share this post


Link to post
Share on other sites
I checked those settings, and they do point to a valid exe. How is it that other applications (e.g. AIM) interact with my browser without any problems... they obviously don't do exactly this.

Share this post


Link to post
Share on other sites
Quote:
Original post by nihilisticod
I checked those settings, and they do point to a valid exe. How is it that other applications (e.g. AIM) interact with my browser without any problems... they obviously don't do exactly this.

This information can be retrieved from the registry, check out: "HKEY_CLASSES_ROOT\HTTP\Shell\Open\Command".

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement