Results 1 to 4 of 4

Thread: Detecting system events with the help of C#

  1. #1
    Join Date
    Apr 2009
    Posts
    69

    Detecting system events with the help of C#

    Hello,

    I have requirement to create a small application that can detect the opening / closing an application on the machine. And must also ensure that it should work fine on the large quantity of data .

    I have tried searching for this kind of requirement but unable to find on the internet so i came here, and that requirement is in the C # and I have no idea realization ...

    If anyone has any suggestion please let me know.

    Thank you in advance

  2. #2
    Join Date
    Jan 2009
    Posts
    140

    Re: Detecting system events with the help of C#

    According to me Detecting the opening or closing of an application at real time cannot be predict... Against the method by Process.getProcess
    allows to know all the processes running, so you are allowed to can call this method regularly (with a timer for example) and can compare the results to see if a process was started or stopped.

    To find out which application is active, it must pass through the native Windows functions Invoke by DllImport attribute. I am not sure about exactly what functions because I have to reinstall my PC and I have not yet installed the MSDN doc ...

  3. #3
    Join Date
    Apr 2009
    Posts
    69

    Re: Detecting system events with the help of C#

    Ok thank you very much, I understood little about it, but if I will get more information and if i will study myself on this point I hope I would definitely be able to find the appropriate solution on it otherwise you already give me a place to look some more in it,I will consider very good start for me.

  4. #4
    Join Date
    Dec 2008
    Posts
    183

    Re: Detecting system events with the help of C#

    You may also find your little code from here:

    GetForegroundWindow This is the method that returns the handle of the active window. You can declare it like this:

    Code:
      using System. Runtime. InteropServices; 
      ... 
    
      [DllImport ( "user32.dll")] 
      public static extern IntPtr GetForegroundWindow ();
    Then to get the process that owns this window, you can use GetWindowThreadProcessId:

    Code:
      [DllImport ( "user32.dll")] 
      public static extern long GetWindowThreadProcessId (IntPtr hWnd, ref long lpdwProcessId);

Similar Threads

  1. System not detecting WD caviar green 2TB
    By Agavoli in forum Hardware Peripherals
    Replies: 4
    Last Post: 30-08-2011, 11:02 PM
  2. TrueCrypt is not detecting my non system drive
    By Gania in forum Networking & Security
    Replies: 4
    Last Post: 26-12-2010, 03:42 AM
  3. Where is System Events in mac?
    By Cristoffer in forum Operating Systems
    Replies: 5
    Last Post: 30-05-2010, 12:33 AM
  4. NEC: a system for detecting illegal video upload
    By Glenny in forum Technology & Internet
    Replies: 2
    Last Post: 09-05-2010, 05:57 AM
  5. System hangs on Detecting IDE Drives
    By Snake08 in forum Windows Software
    Replies: 3
    Last Post: 16-11-2009, 10:40 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,715,588,854.75680 seconds with 17 queries