Click here to Skip to main content
15,899,679 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
In my application I have to open default web browser when user clicks on a button. We have to open the default browser irrespective of the location(default web browser path).
Because the application has to open the default web browser in different machines there the location of default web browser may be different……………
So please help me………with your valuable suggestions………….
Thank you……….
Posted

Use the ShellExecute function in that button click event.

syntax:

HINSTANCE ShellExecute(
		_In_opt_  HWND hwnd,
		_In_opt_  LPCTSTR lpOperation,
		_In_      LPCTSTR lpFile,
		_In_opt_  LPCTSTR lpParameters,
		_In_opt_  LPCTSTR lpDirectory,
		_In_      INT nShowCmd
		);



for eg:

ShellExecute(0,0,"www.google.com",0,0,SW_SHOWNORMAL);

when you click on that button the default browser automatically opens with that URL.

All The Best.
 
Share this answer
 
Hi

In your application you can use hosted default web browser please follow of links for get the more information these links can be really use-full for your purpose ;)

http://msdn.microsoft.com/en-us/library/aa752046(v=vs.85).aspx[^]

Using the WebBrowser control, simplified[^]

http://computer-programming-forum.com/82-mfc/c57bb118d81bf221.htm[^]

Of course you can use C++/CLI for integration MFC with .NET technology and lab lab lab ;)

Best Regards.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900