Skip to content

How can I get the exact number of keys of a keyboard?

Eric

Asked Jul 19, 2007, 12:10 PM EDT2 answers
Share
LinkedInX

Eventually I hope I can do that for PDA and chording keyboard, but for now I just wish I can handle the computer keyboard.

I am trying to use the Win32_Keyboard WMI class to get the number of keys; however, it only has "numberoffunctionkeys", which is 12 in genearl. Its name says it is an "extended 101- or 102- keyboard", but the real number is 104 keys. I am not interested in the realationship between these numbers; I just want to get 104 as the return value. So how can I do it?

Even by manually checking windows control panel, I cannot get the information of how many keys exactly on the keyboard, which is 104. I dont know why.

So please give me your suggestions, or solutions, code/project will be perfect! ^_^

Thanks,

2 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • Mike Gold
    0
    not sure myself, although WMI would have been the approach I would have taken as well.  The problem is that unless information about the keyboard is somehow detected by the operating system, there is no way to tell using .NET short of pressing all the keys and counting them :-)
    0
  • 0

    Maybe you could try using assembly to figure out how many keys are on the board. Or maybe C++ could help you out. Just tossing a few ideas out there, C# is a .NET language so whatever .NET supports it supports for the most part. But C++ and assembly can work just about anywhere and get down into the drivers and baseline functions of a system.

    0