Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 02-05-2009
Member
 
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
Reply With Quote
  #2  
Old 02-05-2009
Member
 
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 ...
Reply With Quote
  #3  
Old 02-05-2009
Member
 
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.
Reply With Quote
  #4  
Old 02-05-2009
Member
 
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);
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


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


All times are GMT +5.5. The time now is 02:54 PM.