Click here to Skip to main content
15,885,979 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi
I want to write a program that Watch system events and I`m using WMI with C#.
the program watch the following type of events:
1)process events(Creation,Deletion).
2)mouse events(Move,keypress).
3)keyboard events(Keypress).
now i want to raise and event every time user press a key and every time he move the mouse or press a key.
is that possible by using WMI?
if that so, then how ?
if not what is the best way?

thanks
Posted

You cannot do that in WMI and it would be very inefficient for it to do so.

This is the relm of Keyboard and Mouse global hooks. Google for "Keyboard Hook" and "Mouse Hook" for examples.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 12-Apr-11 12:31pm    
That is correct. My 5.
--SA
Espen Harlinn 12-Apr-11 15:30pm    
5ed!
You are confused. As a universal and possible system-global tool you should use the Hooks. Start from here:
http://msdn.microsoft.com/en-us/library/ms644960(v=vs.85).aspx[^].

In more simple and specialized cases just handling your windows application messages will solve the problems.

—SA
 
Share this answer
 
Comments
Espen Harlinn 12-Apr-11 15:31pm    
Good link, my 5 :)
Sergey Alexandrovich Kryukov 12-Apr-11 16:28pm    
Thank you, Espen.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900