Hi,
I'm trying to open a URL in a browser with ShellExecute, but nothing happens- just nothing.
What could be the problem?Code:ShellExecute(NULL, "open", "http://www.google.com", NULL, NULL, SW_SHOWNORMAL);
Thanks.
Hi,
I'm trying to open a URL in a browser with ShellExecute, but nothing happens- just nothing.
What could be the problem?Code:ShellExecute(NULL, "open", "http://www.google.com", NULL, NULL, SW_SHOWNORMAL);
Thanks.
MSND -- ShellExecute
I doubt Google's URL would be interpreted as being a file on your computer. Check the return value. It's probably telling you it can't find the file.
Last edited by MacGyver; 04-22-2007 at 02:24 AM. Reason: Fixed bad URL.
What would you use to open an URL in the default browser then? This used to work for me some time ago.
edit: it returns 1.
I tried looking through the return values to find which one was 1, and I got the following table:
I don't see 1 in there. Doublecheck the return value or find out what a return value of 1 means. A value less than or equal to 32 means an error occurred.Code:ERROR_FILE_NOT_FOUND = 2 ERROR_PATH_NOT_FOUND = 3 ERROR_DDE_FAIL = 1156 ERROR_NO_ASSOCIATION = 1155 ERROR_ACCESS_DENIED = 5 ERROR_DLL_NOT_FOUND = 1157 ERROR_CANCELLED = 1223 ERROR_NOT_ENOUGH_MEMORY = 8 ERROR_SHARING_VIOLATION = 32 ERROR_BAD_FORMAT = 11 SE_ERR_ACCESSDENIED = 5 SE_ERR_ASSOCINCOMPLETE = 27 SE_ERR_DDEBUSY = 30 SE_ERR_DDEFAIL = 29 SE_ERR_DDETIMEOUT = 28 SE_ERR_DLLNOTFOUND = 32 SE_ERR_FNF = 2 SE_ERR_NOASSOC = 31 SE_ERR_OOM = 8 SE_ERR_PNF = 3 SE_ERR_SHARE = 26
Apparently you're right; it will open a URL in the default browser. If you can't figure out what the problem is, you could try something like this:
Code:system("start http://www.google.com");
Last edited by MacGyver; 04-22-2007 at 02:39 AM.
Oh, the value was 5, sorry.
ERROR_ACCESS_DENIED = 5
Hmm, why?
Here's a discussion on the subject that may or may not be helpful:
http://www.codeguru.com/forum/showth...hreadid=317498
Thanks, that WAS helpful.
Code:ShellExecute(NULL, "open", "rundll32.exe", "url.dll,FileProtocolHandler http://www.google.com",NULL,SW_SHOWNORMAL);