views:

86

answers:

1

I want to trap windows mouse and keyboard input with the help of event given by windows for detecting system idle or not in C++.

Two things I have tried: 1. Hooking concept, but as antivirus might not allow it and also CPU usage increases if we use hooking. 2. GetLastInputInfo() which also eats CPU usage about 50 %

Anyone can tell me if windows event to trap the mouse and keyboard input is available or not...

+1  A: 

You're not going to do any better than SetWindowsHookEx and WH_KEYBOARD & WH_MOUSE. The documentation for MouseProc & KeyboardProc will be handy as well.

Kevin Montrose