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
  1. Home
  2. General Programming
  3. C#
  4. IE loading event

IE loading event

Scheduled Pinned Locked Moved C#
csharp
6 Posts 3 Posters 0 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.
  • S Offline
    S Offline
    Sunil Shindekar
    wrote on last edited by
    #1

    Hi, I want the details of IE window as soon as IE window is opened either by double clicking from Desktop icon or from Start menu. So is there any event which gets fired when the IE window is opened which I can capture in my program. My program will be a Windows service written in C#. Please let me know how it can be done. Thanks in advance. Sunil

    P 1 Reply Last reply
    0
    • S Sunil Shindekar

      Hi, I want the details of IE window as soon as IE window is opened either by double clicking from Desktop icon or from Start menu. So is there any event which gets fired when the IE window is opened which I can capture in my program. My program will be a Windows service written in C#. Please let me know how it can be done. Thanks in advance. Sunil

      P Offline
      P Offline
      peshkunta
      wrote on last edited by
      #2

      Here is a function I wrote that checks if Internet Exlplorer is running and if it is, the function returns true. You can put this function in a function of a Timer class that executes the IsExplorerRunning function at a specified interval - therefore checking every let's say 100 milliseconds. Let me know if you have any questions. Make sure you include System.Diagnostics: using System.Diagnostics;//put at the beginning //put function in class private bool IsExplorerRunning() { Process[] myProcess = Process.GetProcesses(); int i = 0; try { while (myProcess[i] != null) { if (myProcess[i].ProcessName.ToUpper() == "IEXPLORE") { int i2 = 0; try { while (myProcess[i2] != null) { myProcess[i2].Close(); i2 += 1; } } catch { } return true; } i += 1; } } catch { } int i3 = 0; try { while (myProcess[i3] != null) { myProcess[i3].Close(); i3 += 1; } } catch { } return false; }

      S 1 Reply Last reply
      0
      • P peshkunta

        Here is a function I wrote that checks if Internet Exlplorer is running and if it is, the function returns true. You can put this function in a function of a Timer class that executes the IsExplorerRunning function at a specified interval - therefore checking every let's say 100 milliseconds. Let me know if you have any questions. Make sure you include System.Diagnostics: using System.Diagnostics;//put at the beginning //put function in class private bool IsExplorerRunning() { Process[] myProcess = Process.GetProcesses(); int i = 0; try { while (myProcess[i] != null) { if (myProcess[i].ProcessName.ToUpper() == "IEXPLORE") { int i2 = 0; try { while (myProcess[i2] != null) { myProcess[i2].Close(); i2 += 1; } } catch { } return true; } i += 1; } } catch { } int i3 = 0; try { while (myProcess[i3] != null) { myProcess[i3].Close(); i3 += 1; } } catch { } return false; }

        S Offline
        S Offline
        Sunil Shindekar
        wrote on last edited by
        #3

        Hi, Thanks for your solution. But won't it slow down the system running this code every 100 milliseconds? Regards, Sunil

        P 1 Reply Last reply
        0
        • S Sunil Shindekar

          Hi, Thanks for your solution. But won't it slow down the system running this code every 100 milliseconds? Regards, Sunil

          P Offline
          P Offline
          peshkunta
          wrote on last edited by
          #4

          It works fine on my computer, but I agree there should be a more efficient way of checking. Note the function doesn't contain the code for the Timer object - you can add that to it if you need to. This function checks if Internet Explorer is running. There should be another function which invokes this (IExplorer checking function) The Process object doesn't seem to have a function that checks if a program has started running. If you find a class that has a function that checks that, you don't need the Timer object function to check every so milliseconds.

          G 1 Reply Last reply
          0
          • P peshkunta

            It works fine on my computer, but I agree there should be a more efficient way of checking. Note the function doesn't contain the code for the Timer object - you can add that to it if you need to. This function checks if Internet Explorer is running. There should be another function which invokes this (IExplorer checking function) The Process object doesn't seem to have a function that checks if a program has started running. If you find a class that has a function that checks that, you don't need the Timer object function to check every so milliseconds.

            G Offline
            G Offline
            geekpunk
            wrote on last edited by
            #5

            I may be wrong but I think if you create a new instance of the internet explorer object and one already exists it will take ownership of the running process as for the timer object, I would instead start a running thread and set it to sleep for an acceptable durration of time, upon waking it does the check.

            P 1 Reply Last reply
            0
            • G geekpunk

              I may be wrong but I think if you create a new instance of the internet explorer object and one already exists it will take ownership of the running process as for the timer object, I would instead start a running thread and set it to sleep for an acceptable durration of time, upon waking it does the check.

              P Offline
              P Offline
              peshkunta
              wrote on last edited by
              #6

              I agree about the thread sleep solution. I didn't have it on a thread though, but it would be better to have it on a separate thread. This was just an example - if you want to you can modify the function so it accepts a ref parameter. Then pass your existing object as a ref parameter to this function.

              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