🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

How to Launch Browser?

Started by
3 comments, last by cliffski 24 years, 5 months ago
ARRRRGH. someone help me out here. Im trying to launch the default browser as my game ends, to take the player to my website. Ive tried using ShellExecuteEx to launch documents, which works ok with a text file, but not with a URL. How do people do this? Also there is a short delay where my app hangs whilst the ShelLExecuteEx launches, is there a way to put off the execution until my app has finished closing down? how do other people handle this? thanks in advance! http://www.positech.co.uk
Advertisement
The following code works for me:

SHELLEXECUTEINFO sh;
memset(&sh, 0L, sizeof(SHELLEXECUTEINFO));

sh.cbSize = sizeof(SHELLEXECUTEINFO);
sh.lpVerb = "open";
sh.lpFile = "http://www.gamedev.net/gamedev.asp";
sh.nShow = SW_NORMAL;


ShellExecuteEx(&sh);

HTH,

-mordell


Edited by - mordell on 1/26/00 7:35:45 AM
__________________________________________

Yeah, sure... we are laughing WITH you ...
That code does actually work and launch the browser etc (this is the code i was using) but it also causes a GPF first! I am calling this after ive done all my DirectX cleanup, just before calling PostQuitMessage().
When should you call something like this?
thanks for the super-fast response anyway!

http://www.positech.co.uk

Well, I can''t explain why it GPF''s. I have used similar code in the past without problems, although, since I generally don''t need any information about the application I have launched I typically use just ShellExecute(..).

e.g.
ShellExecute(0L, "open", "http://www.gamedev.net/gamedev.asp", 0L, 0L, SW_NORMAL);

It shouldn''t matter where or what context the call is made as it spawns a seperate process. However, if your filling in the hwnd param, and your hwnd gets destroyed, I don''t know what it would do.

If you remove the ShellExecute call, the GPF goes away?

-mordell
__________________________________________

Yeah, sure... we are laughing WITH you ...
Ive sussed it.
If i make the ShellExecuteEx call before releasing all my directx stuff, then it seems to work fine, although i dont know why this is.
Im sure it must be able to cope with the HWND being lost, as this sort of thing is usually the last act of a finishing app isnt it...
Anyway thanks again for the truly speedy response, good to know i wasnt heading up a blind alley

http://www.positech.co.uk

This topic is closed to new replies.

Advertisement