how to get control of keyboard and mouse?
-
hiho@ll i just need to sniffer what the user enters and the exact mouse events the user makes (mouse click (which button), mouse moves) and i need to send such events to the OS (windows) the problem: 1. i really have no idea how this could work 2. how can i send such events to the OS on an independent way this means, i just don't know which window is focused (which application gets the events) and that's also what i want! i want to send these events to the OS which processes it for the right application! i don't want to know which app is focused because it's not necessary for what i need to do! (well, later maybe it will be necessary but that's another topic/post) thx@ll
-
hiho@ll i just need to sniffer what the user enters and the exact mouse events the user makes (mouse click (which button), mouse moves) and i need to send such events to the OS (windows) the problem: 1. i really have no idea how this could work 2. how can i send such events to the OS on an independent way this means, i just don't know which window is focused (which application gets the events) and that's also what i want! i want to send these events to the OS which processes it for the right application! i don't want to know which app is focused because it's not necessary for what i need to do! (well, later maybe it will be necessary but that's another topic/post) thx@ll
Hi, to log the users keyboard and mouse activity you'll have to take a look at the 'SetWindowsHookEx' function. This allows you to set system-wide keyboard and mouse hooks which will receive all keyboard and mouse activity. Once you have captured the events you can make use of the 'SendInput' function to send the events to the OS which will handle them as if you were really typing or moving the mouse... Don't think you are, know you are...
-
hiho@ll i just need to sniffer what the user enters and the exact mouse events the user makes (mouse click (which button), mouse moves) and i need to send such events to the OS (windows) the problem: 1. i really have no idea how this could work 2. how can i send such events to the OS on an independent way this means, i just don't know which window is focused (which application gets the events) and that's also what i want! i want to send these events to the OS which processes it for the right application! i don't want to know which app is focused because it's not necessary for what i need to do! (well, later maybe it will be necessary but that's another topic/post) thx@ll
Global hook is the solution to your problem, but hooks are not stable and are specifically used for debugging purposes. While implementing the global hooks be curious O.W it would screw entire system. Have a look at the API's SetWindowsHookEx, UnhookWindowsHookEx etc... You can get tons of information about hooks on codeproject and online MSDN. All the best ! Cheers, Vishal
-
Global hook is the solution to your problem, but hooks are not stable and are specifically used for debugging purposes. While implementing the global hooks be curious O.W it would screw entire system. Have a look at the API's SetWindowsHookEx, UnhookWindowsHookEx etc... You can get tons of information about hooks on codeproject and online MSDN. All the best ! Cheers, Vishal
i'll have a look thx!