Hey,

My want to make creation this time is a program where you would ask the user for a website and then they would input it and then IE/FF would open up and your done!.

Just I'm not sure how I would achieve this.

Just point me in the right direction. Thank you.

Recommended Answers

All 6 Replies

I think you would use the system() function. I'm no expert on the windows command line, but I think you can run programs from it. If so, you could pass a command to run firefox or ie, thought I'm not sure if you can pass the url as a command line parameter.

Once you know the web site, just spawn a process similar to below. Create a string like that, replacing DaniWeb.com with the site you want to go to. Note: this is on my Vista box so your browser might be in a different location on your computer. Right-clikc on your browser's shortcut then select properties. That will tell you the full path to your browser.

system("\"D:\Program Files\Internet Explorer\iexplore.exe\"  www.DaniWeb.com");

On Windows you can just put the website on the command line and it will open in the default browser, i.e. system("http://www.google.com");

On Windows you can just put the website on the command line and it will open in the default browser, i.e. system("http://www.google.com");

doesn't work on Vista

D:\Users\AncientDragon>www.daniweb.com
'www.daniweb.com' is not recognized as an internal or external command,
operable program or batch file.

D:\Users\AncientDragon>

Also tried other variations

Microsoft Windows [Version 6.0.6000]
Copyright (c) 2006 Microsoft Corporation. All rights reserved.

D:\Users\AncientDragon>www.daniweb.com
'www.daniweb.com' is not recognized as an internal or external command,
operable program or batch file.

D:\Users\AncientDragon>http://www.daniweb.com
'http:' is not recognized as an internal or external command,
operable program or batch file.

D:\Users\AncientDragon>"http://www.daniweb.com"
The filename, directory name, or volume label syntax is incorrect.

D:\Users\AncientDragon>

How about?

system("start www.google.com");
system("start http://www.google.com");

That worked on Vista.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.