No announcement yet.

Problem shelling to Internet Explorer

  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem shelling to Internet Explorer

    I have a program that shells to a browser and launches a web site. The code I am using is:

    Rcode& = Shell ("explorer " + "")

    It works but it uses the default browser. So, if Internet Explorer is not the default browser then IE is not used to display the web page.

    I have a need to ensure that IE is used to display this webpage when I shell to it.

    Is there a way to rewrite the command above so that it will always use IE when shelling to my webpage?

  • #2
    Making the assumption that this program is going to be run by someone else on their machine, like you sold me a copy of this program, I would expect that if my default browser is anything but Explorer, that it would use my default browser, and my default language, default resolution, etc. That is why default user settings can be set.
    In some future era, dark matter and dark energy will only be found in Astronomy's Dark Ages.


    • #3

      You can't automatically assume that IE is necessarily going to be installed anyway. Its a good bet, but its not totally impossible to remove and I know some people who do.

      What in the world do you have that requires IE? Personally, I think I'd approach this differently and try to "fix" the html page that requires non-standard code.

      If you 'define' what browser must be used, you might run into problems where people have something like IE v5 or lower installed. Those browser have some serious security threats and you could be asking for tons of trouble automatically firing up one of those browsers against the defined wishes of the owner. I can only imagine the potential legal problems from someone with some deep pockets getting hacked because your program opened up an unpatched copy of IE against the preferred browser settings.

      If you do it this way, you have more guts than I do.

      To answer your question though, 'explorer' is not the name of the Internet Explorer executable. You can use what you have, but you'll have to get the correct program name. Then again, there's no guarantee that MS will keep the name the same in future versions of Windows either
      Last edited by Joe Byrne; 28 Nov 2008, 06:42 PM.
      Software makes Hardware Happen


      • #4
        It pays to be polite

        You should probably check first which browser is the default..
        #DIM ALL
         LOCAL hKey   AS DWORD
         LOCAL zData1 AS ASCIIZ * %MAX_PATH
         LOCAL zData2 AS ASCIIZ * %MAX_PATH
         LOCAL sTest, sTest2 AS STRING
                                                'Test Registry entry for IExplore..
         IF RegOpenKeyEx(%HKEY_CLASSES_ROOT,"CLSID\{0002DF01-0000-0000-C000-000000000046}\LocalServer32", _
                         BYVAL %Null, %KEY_READ, hKey) = %ERROR_SUCCESS  THEN
           RegQueryValueEx hKey, "", BYVAL %Null, BYVAL %Null, BYVAL VARPTR(zData1), %MAX_PATH
           RegCloseKey hKey
           ExpandEnvironmentStrings BYVAL VARPTR(zData1), BYVAL VARPTR(zData2), %MAX_PATH
         END IF
          FUNCTION = zData2
         LOCAL sTest$, lRes&
         LOCAL szFile, szDir, szExe AS ASCIIZ * %MAX_PATH
          szFile = "Dummy.htm"                                  ' e.g. a test file in the app dir
          szDir  = CURDIR$
          lRes = FindExecutable (szFile, szDir, szExe)          ' find associated executable (browser)
          ' MsgBox " Default Browser is: "+ szExe
          IF lRes > 32 THEN                                     ' %SE_ERR_FNF = 2  %SE_ERR_NOASSOC = 31
            IF INSTR(LCASE$(szExe), "iexplore.exe") = 0 THEN    ' default browser NOT IE
              sTest = FindIEinReg()
              IF LEN(sTest) THEN
                lRes = MSGBOX ("IE is available but NOT the default browser, OK to run IE?", %MB_YESNO, "Warning")
                IF lRes = %IDNO THEN EXIT FUNCTION
                szExe = sTest
                MSGBOX "IE required but not available - Goodby" : EXIT FUNCTION
              END IF
            END IF
            lRes = SHELL(szExe + " " + "[URL][/URL]", %SW_SHOWNORMAL)
          END IF
        Last edited by Dave Biggs; 29 Nov 2008, 11:05 PM. Reason: Errors fixed & new code added to find IE thru registry
        Rgds, Dave


        • #5
          Use SearchPath () WinAPI function for "iexplorer.exe."

          If found -
          1. Hope/Pray that it is is in fact "Microsoft Internet Explorer" and that it is completely installed correctly.
          2. SHELL/ShellExecute/ShellExecuteEx/CreateProcess passing the file name to be opened

          Michael Mattias
          Tal Systems (retired)
          Port Washington WI USA
          [email protected]


          • #6
            Just as a secondary thought... IE exposes a couple of COM interfaces when installed. There's probably a way to see if you can initialize one of those objects... if so, IE is installed.

            That might even be 'ideologically' better than looking for a file with a certain file name.
            Michael Mattias
            Tal Systems (retired)
            Port Washington WI USA
            [email protected]


            • #7
              Wait a minute, my bad....

              Here's the real problem....
              I have a need to ensure that IE is used to display this webpage
              Fix that and you can pack up your troubles in your old kit bag and
              Michael Mattias
              Tal Systems (retired)
              Port Washington WI USA
              [email protected]


              • #8
                Originally posted by Michael Mattias View Post
                Use SearchPath () WinAPI function for "iexplorer.exe."
                If no results with that try "iexplore.exe." (no "r" on end.) On my machine (XP) "iexplorer.exe" found no matches but "explore.exe" found 24 in various folders (none of which I recall installing). One was in "C:\Windows\IE7\" and one in "C:\Windows\IE8\"

                Note "iexplore" works here from the Run function in XP.

                "If you can't annoy somebody,
                there's little point in writing."

                Last edited by Gösta H. Lovgren-2; 29 Nov 2008, 01:06 PM.
                It's a pretty day. I hope you enjoy it.


                JWAM: (Quit Smoking):
                LDN - A Miracle Drug:


                • #9
                  Use SearchPath () WinAPI function for "iexplorer.exe."
                  Code modified to search the registry for IE
                  (Sorry about the iexplorer.exe typo before)
                  Rgds, Dave


                  • #10
                    I have a need to ensure that IE is used to display this webpage when I shell to it.
                    BADDDDDD idea.....Its programming like this that makes me NOT want to use a product. (God knows there are too many of them out there) and it is 1 line of code.

                    Display, well that too is up to the programmer to properly code to display as they intended it, but allow the user to use what THEY want to use, and not force something down their throats.
                    Engineer's Motto: If it aint broke take it apart and fix it

                    "If at 1st you don't succeed... call it version 1.0"

                    "Half of Programming is coding"....."The other 90% is DEBUGGING"

                    "Document my code????" .... "WHYYY??? do you think they call it CODE? "


                    • #11
                      Ok, good suggustion all. Thank you.

                      Because my need was to create an easy, unclutterred way for a customer to logon to my Internet Customer customer support site. (Powered by

                      What I decided to do was to write a special browser using FlyFire and the Webbrowser control. The program has just two buttons, one button 'Client Logon' allows the customer to login as a client by a one button click. The other button allows the Technician to logon as master (passworded).

                      This make it very convenient for the customer to connect to our remote customer support.

                      If anyone has need of Remote Customer support programs, that works from any OS platform, I would recomment checking this out:
                      Remote support software for a one time purchase with no subscription