Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I have a html file and I want to open it from my mfc application, One way is shellexecute and it works, but the problem is that you have to pass iexplorer.exe location to the shellexecute as a parameter, which is usually c:\Program Files.... but what if IE is not in c:? what if windows is in another drive like d:? Is there any other way to do this? or is there any function that returns the windows drive?

You're overthinking it. Just call ShellExecute with just the URL:

ShellExecute(0, NULL, pszURL, NULL, NULL, SW_SHOWDEFAULT);

It will open with the default browser.

Why would you want to? What is a good reason? Even Microsoft has basically abandoned IE. Chrome is the defacto "standard" browser. If you want to call IE, then it gets complicated. For testing purposes for yourself, just make IE the default browser and then ShellExecute with the URL as above will launch IE. Joseph Willcoxson Apr 25, 2019 at 21:59 the CHtmlView class is messed up for ultra hd printing. Crops page. But IE itself prints ok. Or any other browser but I have page break issues in others. Also, Edge does not have print background setting. Andrew Truckle Apr 25, 2019 at 22:10

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question . Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers .