Capture all Windows Mobile device keys using the AllKeys API

Norm Sohl points out in his post on the Windows Mobile Team blog that Microsoft is taking further steps to deprecate the GAPI APIs. Check it out here. Norm’s post includes a native code sample. Some folks have asked if AllKeys() can be used from managed code. The answer is yes. Here is the C# P/Invoke signature:

 [DllImport("coredll.dll", SetLastError = true)]
static extern bool AllKeys(bool bAllKeys);

Mike

P.S. If you need to capture a specific key, see RegisterHotKey().