Call ShellExecute() like people said.
Or you could try this solution I saw somewhere before:
Execute rundll32 with the following args:
- "url.dll"
- "FileProtocolHandler"
- Whatever your link is
Printable View
Call ShellExecute() like people said.
Or you could try this solution I saw somewhere before:
Execute rundll32 with the following args:
- "url.dll"
- "FileProtocolHandler"
- Whatever your link is
Something like that. That's not anything complicated.Code:ShellExecute(current_hwnd, "open", "http://www.booyah.com", NULL, NULL, SW_SHOWNORMAL);
The reason that you can't execute iexplore with just iexplore is that the shell can't find iexplore. iexplore needs to be in the path (which is rare) or else you need to pass the full path to it, like "\Program Files\Internet Explorer\iexplorer.exe".
But, of course, the easier way to do it is to use ShellExecute(). You can pass ShellExecute() a file, and it will run the program that you have set to open that type of file by default, just as if you'd double-clicked on the file in explorer.
Note that you'll have to include <windows.h> to use ShellExecute(): ShellExecute() is a Windows-only function and thus by using it you sacrifice some portability.
[edit] On the other hand, explorer.exe is almost always in the path, so if you want to open a folder for the user to view, you can just call
(. is the current directory.)[/edit]Code:system("explorer.exe .");
I wont work can someone post a solution
>> I wont work can someone post a solution
Several solutions have been posted, including one that several people agree is probably best. If you are having trouble implementing that solution, feel free to explain what is not working and maybe we can help you get it working.
I'm assuming it was a typo to say "I" instead of "It", but it seems to fit anyway. :rolleyes:
Don't be so freaking lazy. Even the way you tell us you have trouble is an example of laziness. For those of us that take the time to try to help you, couldn't you do us the favor of telling us what isn't working? Tell us what you tried, what you expected it to do, and what actually happened.
Try to learn how to learn. That's what good programmers must conquer. If you get a job as a programmer, and you're using some software written by some other company, and you're having trouble figuring it out, do you think their tech support wants to hear you say, "It won't work."? I think not.
Try again.
My response was posted much later than I had sent it. I was unaware of the shell execute post when I made my post. I feel that your personal attacks are uncalled for.
I am getting this error with this line
ShellExecute(current_hwnd, "open", "http://www.mywebs.com", NULL, NULL, SW_SHOWNORMAL);
error C2065: 'current_hwnd' : undeclared identifier
>> I was unaware of the shell execute post when I made my post.
ShellExecute was actually suggested twice a full 24 hours earlier.
Unfortunately there is a little more to it than what was in CodeMonkey's example. Use the example in the FAQ, it is more complete and has comments describing a little bit of what it is doing.
BTW, the FAQ I'm referring to is the link in the bar at the top of the page that says FAQ (not the FAQ board if that is where you were looking).
I guess six(6) Thank Yous (Im sorry that some of them are "Thanks") are not enought.
enough