views:

513

answers:

2

I'll be developing something for a Windows Mobile device using CompactFramework/C#. I wonder if there is some event available that can capture any user driven event (click, keypress, ...) in context of the device. Sure, I could add some detection code in any of my click event handler for example but I assume that there hundreds of them.

So is there some event or windows mobile API related call that could help me out?

A: 

You can intercept key presses using the Microsoft.WindowsCE.Form.MessageWindows class. It is impossible to intercept click events.

kgiannakakis
That will only receive events send to your process, not device-wide.
ctacke
+2  A: 

You can capture keyboard events device-wide via hooks (be aware that they are officially unsupported and so could disappear at any future release - though they've been there as long as I've been using CE, which is a long time). We actually added keyboard hook support to the latest version of the SDF if you're after something pre-built or for code. Mouse events, however, are not hookable in CE unless you write a new touch panel driver.

ctacke
+1, will look into this. Thanks!
Leon Tayson