C# Class ScreenToGif.Util.UserActivityHook

This class allows you to tap keyboard and mouse and / or to detect their activity even when an application runes in background or does not have any user interface at all. This class raises common .NET events with KeyEventArgs and MouseEventArgs so you can easily retrive any information you need.
Afficher le fichier Open project: dbremner/ScreenToGif Class Usage Examples

Méthodes publiques

Méthode Description
Start ( ) : void

Installs both mouse and keyboard hooks and starts rasing events

Start ( bool installMouseHook, bool installKeyboardHook ) : void

Installs both or one of mouse and/or keyboard hooks and starts rasing events

Stop ( ) : void

Stops monitoring both mouse and keyboard events and rasing events.

Stop ( bool uninstallMouseHook, bool uninstallKeyboardHook, bool throwExceptions ) : void

Stops monitoring both or one of mouse and/or keyboard events and rasing events.

UserActivityHook ( ) : System

Creates an instance of UserActivityHook object and sets mouse and keyboard hooks.

UserActivityHook ( bool installMouseHook, bool installKeyboardHook ) : System

Creates an instance of UserActivityHook object and installs both or one of mouse and/or keyboard hooks and starts rasing events

To create an instance without installing hooks call new UserActivityHook(false, false)

Private Methods

Méthode Description
CallNextHookEx ( int idHook, int nCode, int wParam, IntPtr lParam ) : int
GetKeyState ( int vKey ) : short
GetKeyboardState ( byte pbKeyState ) : int
KeyboardHookProc ( int nCode, Int32 wParam, IntPtr lParam ) : int

A callback function which will be called every time a keyboard activity detected.

MouseHookProc ( int nCode, int wParam, IntPtr lParam ) : int

A callback function which will be called every time a mouse activity detected.

SetWindowsHookEx ( int idHook, HookProc lpfn, IntPtr hMod, int dwThreadId ) : int
ToAscii ( int uVirtKey, int uScanCode, byte lpbKeyState, byte lpwTransKey, int fuState ) : int
UnhookWindowsHookEx ( int idHook ) : int

Method Details

Start() public méthode

Installs both mouse and keyboard hooks and starts rasing events
Any windows problem.
public Start ( ) : void
Résultat void

Start() public méthode

Installs both or one of mouse and/or keyboard hooks and starts rasing events
Any windows problem.
public Start ( bool installMouseHook, bool installKeyboardHook ) : void
installMouseHook bool true if mouse events must be monitored
installKeyboardHook bool true if keyboard events must be monitored
Résultat void

Stop() public méthode

Stops monitoring both mouse and keyboard events and rasing events.
Any windows problem.
public Stop ( ) : void
Résultat void

Stop() public méthode

Stops monitoring both or one of mouse and/or keyboard events and rasing events.
Any windows problem.
public Stop ( bool uninstallMouseHook, bool uninstallKeyboardHook, bool throwExceptions ) : void
uninstallMouseHook bool true if mouse hook must be uninstalled
uninstallKeyboardHook bool true if keyboard hook must be uninstalled
throwExceptions bool true if exceptions which occured during uninstalling must be thrown
Résultat void

UserActivityHook() public méthode

Creates an instance of UserActivityHook object and sets mouse and keyboard hooks.
Any windows problem.
public UserActivityHook ( ) : System
Résultat System

UserActivityHook() public méthode

Creates an instance of UserActivityHook object and installs both or one of mouse and/or keyboard hooks and starts rasing events
To create an instance without installing hooks call new UserActivityHook(false, false)
Any windows problem.
public UserActivityHook ( bool installMouseHook, bool installKeyboardHook ) : System
installMouseHook bool true if mouse events must be monitored
installKeyboardHook bool true if keyboard events must be monitored
Résultat System