Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Compact Framework / August 2007

Tip: Looking for answers? Try searching our database.

USB Keyboard Detect in WinCE 5.0

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
DrewCE - 17 Aug 2007 18:12 GMT
I have a Windows CE 5.0 based device.  We have a touchscreen, joystick, and
hardware buttons.  The joystick and hardware buttons are mapped to mouse
event and keyboard events respectively, using a custom driver.

We sometimes have a USB Keyboard attached and need to detect that case to
prevent he SIP from displaying.

I've searched and tried several solutions, but nothing has fit the bill yet.
Looking in the registry doesn't seem to work as there is no
"Software\Microsoft\Shell\HasKeyboard" key.  Also, GetKeyboardStatus()
always returns 3 (has keyboard).

I'm guessing that I'm not the first person to need this and am hoping
someone can't point me in the right direction.

Thanks,

Drew
Paul G. Tobey [eMVP] - 17 Aug 2007 18:23 GMT
Does the SIP hide itself as soon as you press a key on the hardware
keyboard?  I think that the OS should do that automatically.  If so, good
enough?

Paul T.

>I have a Windows CE 5.0 based device.  We have a touchscreen, joystick, and
>hardware buttons.  The joystick and hardware buttons are mapped to mouse
[quoted text clipped - 14 lines]
>
> Drew
DrewCE - 17 Aug 2007 18:32 GMT
Unfortunately, no.  Our requirement is to only display the SIP if the
keyboard is not present.

Drew

> Does the SIP hide itself as soon as you press a key on the hardware
> keyboard?  I think that the OS should do that automatically.  If so, good
[quoted text clipped - 20 lines]
>>
>> Drew
Paul G. Tobey [eMVP] - 17 Aug 2007 18:43 GMT
You might try some of the bits hinted at by "USB Function Controller Driver
Bus Interface" in the Platform Builder help for CE5.  Generally, though,
there's no interface to see if a given HID device is there or to talk to HID
devices, as there would be on the desktop.

Paul T.

> Unfortunately, no.  Our requirement is to only display the SIP if the
> keyboard is not present.
[quoted text clipped - 25 lines]
>>>
>>> Drew
DrewCE - 30 Aug 2007 23:30 GMT
Thanks for the help.

Just to follow up a bit.  I was able to partially acheive my goal.

I'm able to poll through the active drivers in the registry.  If a keyboard
driver is present, I can assume that a keyboard is attached.

Here is the code I created:

/// <summary>

/// Polls the registry to see if any keyboard drivers are active. If yes,

/// then it assumes that there is a keyboard attached.

/// </summary>

/// <returns><see cref="true"/> if keyboard was detected.</returns>

public static bool IsPresent()

{

bool isPresent = false;

RegistryKey rk = Registry.LocalMachine.OpenSubKey(@"Drivers\Active");

string[] activeDrivers = rk.GetSubKeyNames();

foreach (string subKeyName in activeDrivers)

{

RegistryKey subKey = rk.OpenSubKey(subKeyName);

try

{

string val = subKey.GetValue("key") as string;

if (val is string && val.EndsWith("Keyboard"))

{

isPresent = true;

break;

}

}

catch { } //no action

}

return isPresent;

}

No warranties implied,

Drew

> You might try some of the bits hinted at by "USB Function Controller
> Driver Bus Interface" in the Platform Builder help for CE5.  Generally,
[quoted text clipped - 32 lines]
>>>>
>>>> Drew

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.