Opening a web page

This is a discussion on Opening a web page within the C++ Programming forums, part of the General Programming Boards category; I have a game that is available freeware and allows the user to play one season; if they wish to ...

  1. #1
    Frustrated Programmer :( phantom's Avatar
    Join Date
    Sep 2001
    Posts
    163

    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
    My site to register for all my other websites!
    'Clifton Bazaar'

  2. #2
    Novice C++ Programmer
    Join Date
    Nov 2003
    Posts
    96
    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.

  3. #3
    Frustrated Programmer :( phantom's Avatar
    Join Date
    Sep 2001
    Posts
    163
    Good point, so do you know the actual C++ code to open a web page?
    My site to register for all my other websites!
    'Clifton Bazaar'

  4. #4
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,490
    Which OS/Compiler do you have?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  5. #5
    Frustrated Programmer :( phantom's Avatar
    Join Date
    Sep 2001
    Posts
    163
    MS Visual C++ on win2k
    My site to register for all my other websites!
    'Clifton Bazaar'

  6. #6
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,490
    Last couple of methods in the FAQ
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  7. #7
    Frustrated Programmer :( phantom's Avatar
    Join Date
    Sep 2001
    Posts
    163
    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 )
    My site to register for all my other websites!
    'Clifton Bazaar'

  8. #8
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    Code:
    ShellExecute( yourHWNDHere, "open", "http://www.google.ca", NULL, NULL, SW_SHOWNORMAL );
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  9. #9
    Frustrated Programmer :( phantom's Avatar
    Join Date
    Sep 2001
    Posts
    163
    If anyone in the future is reading this you also need to #include <windows.h> to get this line to work
    My site to register for all my other websites!
    'Clifton Bazaar'

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Opening a web page
    By charon12 in forum C++ Programming
    Replies: 1
    Last Post: 08-24-2004, 01:17 AM
  2. Web Page Organization
    By Khelder in forum C# Programming
    Replies: 4
    Last Post: 05-06-2004, 10:24 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21