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);


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

Comments (1)

  1. Harshal says:


    Is there any way to disable the camera button on HTC S710? I tried allkeys(true) but the camera and function buttons are still working. I want to make all of them disabled. Please let me know.



Skip to main content