-
Opening a web page
I have a game that is available freeware and allows the user to play one season; if they wish to continue then they are asked to purchase the full game.
Question -
I would make a button called 'Buy me', what would be the code to shut the game down and then open the web page with the purchase form. Please note that I can shut down the program (duh) but have no idea how to shut it down and then run one final command (open the web page).
James
edit: a few spelling errors :D
-
Well I can't help you with the web page stuff but what I can say is you'd probably have it open the webpage first, then shut itself down. But since computers are so fast, it would seemingly shut itself down before the webpage totally loads. I don't think it's possible to run a command after a program is totally shut down, without starting some other program/script.
-
Good point, so do you know the actual C++ code to open a web page?
-
Which OS/Compiler do you have?
-
-
Last couple of methods in the FAQ
-
The FAQ shows how to run a child program (and thanks for that), what I am after is how to open a web page; of course I have no idea which web browser the client is using.
At the moment I have the line -
system("http://www.test.com");
but this brings up an error (too fast to read :( )
-
Code:
ShellExecute( yourHWNDHere, "open", "http://www.google.ca", NULL, NULL, SW_SHOWNORMAL );
-
If anyone in the future is reading this you also need to #include <windows.h> to get this line to work