Thread: Launching the default browser

  1. #1
    Registered User
    Join Date
    Mar 2005
    Posts
    4

    Launching the default browser

    Hello. I am required to write a script to launch the default browser from a DOS program, with a specified url. I am using Borland C++ 5.02 on Windows XP Home Edition, with Service Pack 2. Which function should I use?

  2. #2

  3. #3
    Registered User
    Join Date
    Mar 2005
    Posts
    4
    The problem is, the url is variable, i.e. it is generated by the program. I tried using system to launch Internet Explorer directly with a URL. It used to work fine on Windows 98. Now, the problem is that after system(path) launches the browser, the program freezes. Any idea what I can do about it?

    ShellExecute doesn't seem to be available in the Compiler, I checked the documentation. I tried using spawnl, but I don't seem to be able to use it to specify a URL directly.

    Code:
    strcpy(url,"http://www.icq.com/whitepages/search_result.php?search_type=&fname=");
    strcat(url,inputfirstname);
    strcat(url,"&lname=");
    strcat(url,inputlastname); strcat(url,"&nickname=&gender=&age_group=&home_country_code=&email=");
    strcat(url,inputemail);
    strcpy(path,"c:\\progra~1\\intern~1\\iexplore.exe \"");
    strcat(path,url);
    strcat(path,"\"");
    system(path);

  4. #4
    Registered User
    Join Date
    Mar 2005
    Posts
    4
    Ok, I got a perfect way to launch the default browser, but again, it is using system. I was wondering is there was any other way (perhaps using spawnl or something), because system causes the program to freeze under Windows XP. The same program runs fine on Windows 98.

  5. #5
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    Use the technique in the link I posted or use ShellExecute[Ex].

    Get a new development environment, like Dev-C++ if you current one doesn't support the Win32 API.

    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. spawn default html browser
    By odysseus.lost in forum C Programming
    Replies: 6
    Last Post: 11-11-2005, 12:27 PM
  2. How Can I Find the Default Browser?
    By DeepFyre in forum Windows Programming
    Replies: 2
    Last Post: 02-12-2005, 07:55 PM
  3. Getting Default Browser and Running It
    By Driver in forum Windows Programming
    Replies: 4
    Last Post: 10-22-2004, 02:08 PM
  4. default browser and multiple users
    By Waldo2k2 in forum Tech Board
    Replies: 6
    Last Post: 10-05-2003, 12:03 PM
  5. Opening the default browser with a specified URL
    By sundeeptuteja in forum C++ Programming
    Replies: 4
    Last Post: 08-04-2002, 02:54 AM