Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 52929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T16:59:01+00:00 2026-05-10T16:59:01+00:00

For years I’ve been using ShellExecute() API to launch the default web browser from

  • 0

For years I’ve been using ShellExecute() API to launch the default web browser from within my applications. Like this:

ShellExecute( hwnd, _T('open'),      _T('http://www.winability.com/home/'),      NULL, NULL, SW_NORMAL ); 

It’s been working fine until a couple of weeks ago, when Google released its Chrome browser. Now, if Chrome is installed on the computer, the ShellExecute API no longer opens a web page.

Has anyone figured out yet how to solve this problem? (Short of detecting Chrome and displaying a message telling the user it’s Chrome’s fault?)

EDIT: the code provided by Sergey seems to work, so I’ve accepted it as ‘the’ answer. Except that I don’t like the call to WinExec: MSDN reads that WinExec is provided only for compatibility with 16-bit applications. IOW, it may stop working with any Service Pack. I did not try it, but I would not be surprised if it has already stopped working with Windows x64, since it does not support 16-bit applications at all. So, instead of WinExec, I’m going to use ShellExecute, with the path taken from the registry like Sergey’s code does, and the URL as the argument. Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T16:59:02+00:00Added an answer on May 10, 2026 at 4:59 pm

    Here is the code that works across all browsers. The trick is to call WinExec if ShellExecute fails.

    HINSTANCE GotoURL(LPCTSTR url, int showcmd) {     TCHAR key[MAX_PATH + MAX_PATH];      // First try ShellExecute()     HINSTANCE result = 0;      CString strURL = url;      if ( strURL.Find('.htm') <0 && strURL.Find('http') <0 )         result = ShellExecute(NULL, _T('open'), url, NULL, NULL, showcmd);      // If it failed, get the .htm regkey and lookup the program     if ((UINT)result <= HINSTANCE_ERROR) {          if (GetRegKey(HKEY_CLASSES_ROOT, _T('.htm'), key) == ERROR_SUCCESS) {             lstrcat(key, _T('\\shell\\open\\command'));              if (GetRegKey(HKEY_CLASSES_ROOT,key,key) == ERROR_SUCCESS) {                 TCHAR *pos;                 pos = _tcsstr(key, _T('\'%1\''));                 if (pos == NULL) {                     // No quotes found                     pos = strstr(key, _T('%1'));       // Check for %1, without quotes                     if (pos == NULL)                   // No parameter at all...                         pos = key+lstrlen(key)-1;                     else                         *pos = '\0';                   // Remove the parameter                 }                 else                     *pos = '\0';                       // Remove the parameter                  lstrcat(pos, _T(' \''));                 lstrcat(pos, url);                 lstrcat(pos, _T('\''));                 result = (HINSTANCE) WinExec(key,showcmd);             }         }     }      return result; } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 119k
  • Answers 119k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Not that I know of. In particular, you can define… May 11, 2026 at 11:53 pm
  • Editorial Team
    Editorial Team added an answer The example you've given isn't an abstract factory. Abstract factories… May 11, 2026 at 11:53 pm
  • Editorial Team
    Editorial Team added an answer Stored procedures The Access database engine when in ANSI-92 Query… May 11, 2026 at 11:53 pm

Related Questions

For years I have been using the DEBUG compiler constant in VB.NET to write
For years I've been using ShellExecute() API to launch the default web browser from
I have been a Half-Life lover for years. I have a BS in CS
I have been hearing and reading about Agile for years. I own a book
I'm a ASP.NET and ABAP developer. For years, I used RFC's to communicate with

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.