I recently received an email from Idelso, a .NET Compact Framework developer asking:

How can we, programmatically, detect (for Pocket PC OS) if a PDA or phone has a built-in keyboard, so we do not have to use the Soft Input Panel (SIP) control? I have been looking around for the answer, but I haven't been successful yet.

There are two ways:
1) P/Invoke GetKeyboardStatus() - this is the preferred method but may not work as some OEMs have not been implementing it - this will change with the advent of Pocket PC devices with keyboards,
2) query the registry for a HasKeyboard key in the “HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Shell” hive (or whatever it is called) - please note that this method is unsupported and may change in the future (as OEMs implement GetKeyboardStatus). Download the P/Invoke Libray sample for the code.

Geoff Schwab who many of you may know from the .NET Compact Framework newsgroup has added sample code for both approaches to the “Create a P/Invoke Library” whitepaper and sample in the .NET Compact Framework section of the MSDN Library. The article will not be refreshed until next week but the sample code download has been refresh and is available here. We will also update the .NET Compact Framework FAQ next week.

Thanks for the question Idelso! If you have encountered a problem that you think deserves a FAQ entry please let us know by send email to netcfaq@microsoft.com.