Opening web pages in win32
Is there a Win32 function that when called can open the default web browser and load a specific html document? I remember seeing something similar to this in a book but I lost the book!
I have seen many programs in windows that use a web page for a help document but I can''t seem to find out how they did it.
http://www.crosswinds.net/~druidgames/resist.jpg
Their is an easy way and a hard way.
I'll show you the easy:
You must use the api function: ShellExecute().
Here is how you open the web-site to altavista.com:
ShellExecute(
NULL, // Parent window
_T("open"), // command verb thing
_T("URL=http://www.altavista.com"), // Adresse thing
NULL, // file-params
NULL, // Can´t remeber just NULL
SW_MAXIMIZE) // Show-param.
Please look this function up, because I can´t recall all it´s params.
- Hope this will work -
Edited by - The big Question? on 4/26/00 3:44:19 PM
I'll show you the easy:
You must use the api function: ShellExecute().
Here is how you open the web-site to altavista.com:
ShellExecute(
NULL, // Parent window
_T("open"), // command verb thing
_T("URL=http://www.altavista.com"), // Adresse thing
NULL, // file-params
NULL, // Can´t remeber just NULL
SW_MAXIMIZE) // Show-param.
Please look this function up, because I can´t recall all it´s params.
- Hope this will work -
Edited by - The big Question? on 4/26/00 3:44:19 PM
<<>> The Big ? <<>>
I tried ShellExecute but it did not work!
I found some info on this function at the url below:
http://msdn.microsoft.com/library/psdk/shellcc/shell/Functions/ShellExecute.htm
I found some info on this function at the url below:
http://msdn.microsoft.com/library/psdk/shellcc/shell/Functions/ShellExecute.htm
http://www.crosswinds.net/~druidgames/resist.jpg
Disregard my last post. My compiler was using the wrong settings. I re-compiled the code and it worked great.
http://www.crosswinds.net/~druidgames/resist.jpg
Please notice, I forgot to tell you something which could be important.
This only works if the user has connected the *.htm/*.html files with a browser.
What I´m trying to say is simply, even through the user has installed a browser, this might not work, if he has disconnected some default-settings.
But this trick works 95% of the time, so it´s not bad.
(If you need a more safe method you need dig into the WinInet, which is rather long and complex API (MS keeps adding to it!)).
By the way you can also use this to start the Mail-program (Outlook or whatever), so the user can email you, just use "mailto:bla@bla.com" instead of the "URL=bla-bla" stuff.
- The Big ? -
This only works if the user has connected the *.htm/*.html files with a browser.
What I´m trying to say is simply, even through the user has installed a browser, this might not work, if he has disconnected some default-settings.
But this trick works 95% of the time, so it´s not bad.
(If you need a more safe method you need dig into the WinInet, which is rather long and complex API (MS keeps adding to it!)).
By the way you can also use this to start the Mail-program (Outlook or whatever), so the user can email you, just use "mailto:bla@bla.com" instead of the "URL=bla-bla" stuff.
- The Big ? -
<<>> The Big ? <<>>
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement