opening webpages

This is a discussion on opening webpages within the Networking/Device Communication forums, part of the General Programming Boards category; i want to know the specific code used to open a webpage. i was bored and decided to make a ...

  1. #1
    C++No0b!!!
    Join Date
    Jul 2005
    Location
    penn
    Posts
    66

    opening webpages

    i want to know the specific code used to open a webpage. i was bored and decided to make a lil dos program that takes input for url and stuff and opens the page.
    any help would be great. thanks

  2. #2
    The superhaterodyne twomers's Avatar
    Join Date
    Dec 2005
    Location
    Ireland
    Posts
    2,262
    Google ShellExecute, or search these forums for that

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,497
    Mmm, you mean 'dos' as in a win32 console, like what you get with modern 32-bit compilers?

    Or do you mean 'dos', as in some ancient 16-bit fossil with Turbo-C ?

    Check out the networking forum (where this thread now lives).
    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.

  4. #4
    C++No0b!!!
    Join Date
    Jul 2005
    Location
    penn
    Posts
    66
    i got it using that shellexecute function (i googled it ^^)
    thanks

  5. #5
    C++No0b!!!
    Join Date
    Jul 2005
    Location
    penn
    Posts
    66
    how do you make the page open in a specific browser

    say i have firefox set as my default browser but i want this specific page to open in internet explorer
    how do i make it do this

  6. #6
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,497
    I'd download the "IE Tab" extension for firefox if I wanted to load specific pages in an "IE browser".

    Most browsers accept some kind of command line parameters, say
    iexplore "http://www.google.com"
    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
    C++No0b!!!
    Join Date
    Jul 2005
    Location
    penn
    Posts
    66
    so what your saying is in:
    Code:
    ShellExecute( NULL, "open", URL, NULL, "C:\\", SW_SHOW );
    it should look like:
    Code:
    ShellExecute( NULL, "open", URL, NULL, "C:\\", SW_SHOW, iexplorer.exe );
    ???

    heres the program:
    Code:
    //Dan Kemper (danthemank@gmail.com)
    //webpage opening program
    
    #include <conio.h>
    #include <iostream>
    #include <windows.h>
    
    using namespace std;
    
    int main()
    {
        char *URL="www.google.com";
        char input[100];
    
        cout << "Enter the url for the website you want opened." << endl << endl;
        cout << "URL: ";
        cin.get(input,100);
        cin.ignore(80,'\n');
        
        URL=input;
        
        ShellExecute( NULL, "open", URL, NULL, "C:\\", SW_SHOW );
        
        return 0;
    }
    wait, should the c:// be the file path to the specific browser?


    the program runs perfect as is, i just want it to open in internet explorer
    Last edited by ReLiEnThAwK; 08-15-2006 at 01:46 PM.

  8. #8
    C++No0b!!!
    Join Date
    Jul 2005
    Location
    penn
    Posts
    66
    i cant find anywhere that tells me what these parameters do or control

  9. #9
    C++No0b!!!
    Join Date
    Jul 2005
    Location
    penn
    Posts
    66
    i finally figured it out.

    this is what it needs to look like:

    Code:
    ShellExecute( NULL, "open", "iexplore.exe", URL, "C:\\", SW_SHOW );

  10. #10
    Registered User
    Join Date
    Oct 2005
    Location
    Brasil
    Posts
    220

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. opening empty file causes access violation
    By trevordunstan in forum C Programming
    Replies: 10
    Last Post: 10-21-2008, 11:19 PM
  2. opening files sequentially
    By barneygumble742 in forum C++ Programming
    Replies: 9
    Last Post: 12-21-2006, 10:26 AM
  3. need help with file opening errors
    By lld4rkll in forum C++ Programming
    Replies: 6
    Last Post: 07-13-2006, 06:20 AM
  4. opening webpages
    By spiderman in forum C++ Programming
    Replies: 2
    Last Post: 06-29-2005, 08:01 AM
  5. Stop opening in safe-mode
    By ihsir in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 02-03-2002, 08:59 PM

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