Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. How to obtain the exe name "iexplore.exe" of Internet Explorer using Process class

How to obtain the exe name "iexplore.exe" of Internet Explorer using Process class

Scheduled Pinned Locked Moved C#
helptutorialquestion
5 Posts 4 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    ganeshvijay
    wrote on last edited by
    #1

    Hi Is there any way to get the exe name : "iexplore.exe" using the System.Diagnostics.Process or any other class? Pls help me with sample cpodes, if any. Problem is that, the code, "processObj.MainModule.FileName" returns "explorer.exe" which is not the correct one, I think. Cheers, ganesh.

    T H D 3 Replies Last reply
    0
    • G ganeshvijay

      Hi Is there any way to get the exe name : "iexplore.exe" using the System.Diagnostics.Process or any other class? Pls help me with sample cpodes, if any. Problem is that, the code, "processObj.MainModule.FileName" returns "explorer.exe" which is not the correct one, I think. Cheers, ganesh.

      T Offline
      T Offline
      turbochimp
      wrote on last edited by
      #2

      It's true that explorer.exe is not MS Internet Explorer (it's Windows Explorer). However, if IE is running at the time the processes are enumerated, iexplore.exe should also appear in the list. I used the following code to list the processes on my workstation, and it worked like a charm: using System; using System.Diagnostics; class ProcEnumerator { /// /// The main entry point for the application. /// [STAThread] static void Main(string[] args) { Process[] localProcess = System.Diagnostics.Process.GetProcesses(); foreach(Process p in localProcess) { try { Console.WriteLine(p.MainModule.FileName); } catch(Exception excp) { //Account for non-executable processes like 'System' and 'Idle' Console.WriteLine("*** '{0}': {1} - may be a placeholder.", p.ProcessName, excp.Message); } } Console.ReadLine(); } }

      The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’

      1 Reply Last reply
      0
      • G ganeshvijay

        Hi Is there any way to get the exe name : "iexplore.exe" using the System.Diagnostics.Process or any other class? Pls help me with sample cpodes, if any. Problem is that, the code, "processObj.MainModule.FileName" returns "explorer.exe" which is not the correct one, I think. Cheers, ganesh.

        H Offline
        H Offline
        Heath Stewart
        wrote on last edited by
        #3

        Actually, "Internet Explorer" is the WebBrowser control, a culmination of MSHTML, urlmon, and several other components. The WebBrowser control can be used in any ActiveX container, which both iexplore.exe and explorer.exe are. If you, for example, started iexplore.exe and then browsed to a folder (like C:\), it functions like Windows Explorer. The reverse is true because Windows Explorer is an ActiveX container that can host the WebBrowser control (just like you can in a .NET application, VB6 application, and many other client application frameworks). So, when the MainModule.FileName returns explorer.exe, it is correct (and it couldn't be wrong anyway - the OS has to know what's loaded into the process space otherwise nothing works). DeskBand developers (like the Search bar, Media bar, etc.) like myself use this fact to make sure the band isn't initialized if the containing process is explorer.exe, for example (so that it is only loaded into what most people call "Internet Explorer").

        Microsoft MVP, Visual C# My Articles

        T 1 Reply Last reply
        0
        • H Heath Stewart

          Actually, "Internet Explorer" is the WebBrowser control, a culmination of MSHTML, urlmon, and several other components. The WebBrowser control can be used in any ActiveX container, which both iexplore.exe and explorer.exe are. If you, for example, started iexplore.exe and then browsed to a folder (like C:\), it functions like Windows Explorer. The reverse is true because Windows Explorer is an ActiveX container that can host the WebBrowser control (just like you can in a .NET application, VB6 application, and many other client application frameworks). So, when the MainModule.FileName returns explorer.exe, it is correct (and it couldn't be wrong anyway - the OS has to know what's loaded into the process space otherwise nothing works). DeskBand developers (like the Search bar, Media bar, etc.) like myself use this fact to make sure the band isn't initialized if the containing process is explorer.exe, for example (so that it is only loaded into what most people call "Internet Explorer").

          Microsoft MVP, Visual C# My Articles

          T Offline
          T Offline
          turbochimp
          wrote on last edited by
          #4

          Agreed. I interpreted the question as asking how to determine if iexplore.exe was executing. If the question is "How do I tell if any 'IE' components are currently hosted?" in a process started by explorer.exe, for instance, it would be a more difficult task to determine how much "IE"-ness the explorer.exe process displayed (searching the associated modules blah blah blah). Thanks for the clarification. Jared

          The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’

          1 Reply Last reply
          0
          • G ganeshvijay

            Hi Is there any way to get the exe name : "iexplore.exe" using the System.Diagnostics.Process or any other class? Pls help me with sample cpodes, if any. Problem is that, the code, "processObj.MainModule.FileName" returns "explorer.exe" which is not the correct one, I think. Cheers, ganesh.

            D Offline
            D Offline
            DavidR_r
            wrote on last edited by
            #5

            Use property ModuleName Process[] ProcessList = Process.GetProcesses(); ArrayList ProcessNames =new ArrayList (); foreach(Process myProcess in ProcessList) { String myString = myProcess.ProcessName ; string myModuleName; try { myModuleName= myProcess.MainModule.ModuleName; } catch { myModuleName = "no name available"; } Console.WriteLine(myModuleName); } DavidR

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups