Thread: 'default' exes

  1. #1
    Grammar Police HybridM's Avatar
    Join Date
    Jan 2003
    Posts
    355

    'default' exes

    In a program I'm developing I want the help to be on the internet, so I've got this so far:
    Code:
    	case ID_HELP_ONLINEHELP:
    		{
    			char PathtoNet[] = "C:\\Program Files\\Internet Explorer\\iexplore.exe www.newscientist.com";
    				
    			WinExec(PathtoNet, SW_SHOWNORMAL); 
    		}
    		break;
    Obviously there are a couple of problems with this method. Firstly WinExec isn't unicode which is a problem. Secondly, I have to hard code the path of the browser, so if you're not using internet explorer and it's not stored in C:\Program Files\Internet Explorer you're out of luck.

    This brings me, finally, to my question. Does windows maintain somewhere the path to the executable of the default browser for the system? If not how would I go about obtaining this.

    btw newscientist is just my test website.
    Thor's self help tip:
    Maybe a neighbor is tossing leaf clippings on your lawn, looking at your woman, or harboring desires regarding your longboat. You enslave his children, set his house on fire. He shall not bother you again.

    OS: Windows XP
    Compiler: MSVC

  2. #2
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    Code:
    ShellExecute(NULL or hwnd, NULL, TEXT("http://www.newscientist.com"), NULL, NULL, SW_SHOWNORMAL)
    Last edited by anonytmouse; 10-31-2003 at 11:53 PM.

  3. #3
    Grammar Police HybridM's Avatar
    Join Date
    Jan 2003
    Posts
    355
    Thanks mate, one more question, can I make it open a new window regardless?
    If there is already an instance of the browser running it just opens it in that window.
    Thor's self help tip:
    Maybe a neighbor is tossing leaf clippings on your lawn, looking at your woman, or harboring desires regarding your longboat. You enslave his children, set his house on fire. He shall not bother you again.

    OS: Windows XP
    Compiler: MSVC

  4. #4
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    This google search 'open web page in new window shellexecute' reveals this web page:

    http://www.codeproject.com/internet/urlnewwindow.asp

  5. #5
    Grammar Police HybridM's Avatar
    Join Date
    Jan 2003
    Posts
    355
    Indeed, thanks.
    Thor's self help tip:
    Maybe a neighbor is tossing leaf clippings on your lawn, looking at your woman, or harboring desires regarding your longboat. You enslave his children, set his house on fire. He shall not bother you again.

    OS: Windows XP
    Compiler: MSVC

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. member as default argument
    By MarkZWEERS in forum C++ Programming
    Replies: 2
    Last Post: 03-23-2009, 08:09 AM
  2. Utilizing another compiled program for a task.
    By kotoroshinoto in forum C Programming
    Replies: 6
    Last Post: 06-03-2008, 01:43 PM
  3. get keyboard and mouse events
    By ratte in forum Linux Programming
    Replies: 10
    Last Post: 11-17-2007, 05:42 PM
  4. A question about constructors...
    By Wolve in forum C++ Programming
    Replies: 9
    Last Post: 05-04-2005, 04:24 PM
  5. Switching Default Buttons :: MFC
    By kuphryn in forum Windows Programming
    Replies: 2
    Last Post: 07-02-2002, 04:08 PM