Thanks in Advance
Jeetu
// Handle AltGr
if (uiVk == VK_RMENU) {
// Also send a Right Control
const USAGE_TO_SCANCODE *pUsageToSc = FindUsageToSc(USAGE_RCONTROL);
DEBUGCHK(pUsageToSc);
GenerateKeyInfo(pUsageToSc, &uiVk, &uiSc, &dwFlags, hidpKeyEvent);
if (uiVk == VK_RCONTROL) {
UpdateKeyState(pKeyStateFlags, (UINT8) uiVk, hidpKeyEvent);
KeyboardEvent(uiVk, uiSc, dwFlags);
}
else {
RETAILMSG(1, (_T("Keyboard: AltGr processing failed. Returned
vkey 0x%02X\r\n"),
uiVk));
}
}
where GenerateKeyInfo is something like
// Expands a usage, scan code, and flags to a full scan code and virtual
key.
static
void
GenerateKeyInfo(
const USAGE_TO_SCANCODE *pUsageToSc,
PUINT puiVk,
PUINT puiSc,
PDWORD pdwFlags,
HIDP_KEYBOARD_DIRECTION hidpKeyEvent
)
{
DEBUGCHK(pUsageToSc);
DEBUGCHK(puiVk);
DEBUGCHK(puiSc);
DEBUGCHK(pdwFlags);
*puiSc = pUsageToSc->uiSc;
*pdwFlags = 0;
if (hidpKeyEvent == HidP_Keyboard_Break) {
*pdwFlags |= KEYEVENTF_KEYUP;
}
// Prepend extended bits
switch (GET_EB(pUsageToSc->uiFlags)) {
case EB_E0:
*puiSc |= SC_EXTENDED_BITS;
*pdwFlags |= KEYEVENTF_EXTENDEDKEY;
break;
case EB_E114:
*puiSc |= SC_E1_BITS;
break;
case EB_NONE:
break;
default:
// Why are you here?
DEBUGCHK(FALSE);
};
// Convert scan code to virtual key
DEBUGCHK(IsAPIReady(SH_WMGR) == TRUE); // Exception if FALSE
*puiVk = MapVirtualKey(*puiSc, MAP_SC_TO_VK);
}
This ProcessModifier() code will force all right alts to AltGr. This will be
fine if you only need to support AltGr keyboards.
If you wish to support both AltGr and non-AltGr keyboards, you will want the
Layout Manager to tell kbdhid if it should use AltGr or not for the current
keyboard layout. This information is stored in the Input Language's
fLocaleFlags. If fLocaleFlags includes KLLF_ALTGR, then AltGr should be
used. At boot and whenever the Input Language is changed, the Layout Manager
should send an IOCTL to each KBDx: driver to report the fLocaleFlags. This
should be done in a similar way to the reporting the auto repeat timings.
For example, something like the following could be added to
KbdNotificationThread() in laymgr.cpp:
// Set the keyboard's locale flags
if (g_ili.hkl != INVALID_HKL) {
DWORD dwLocaleFlags = g_ili.il.fLocaleFlags;
DeviceIoControl(hKbd, IOCTL_KBD_SET_LOCALE_FLAGS,
&dwLocaleFlags,
sizeof(dwLocaleFlags), NULL, 0, NULL, NULL);
}
Also, SetInputLanguage() should broadcast the new fLocaleFlags to all KBDx:
drivers.
--
Steve Schrock
Windows CE Device Drivers
This posting is provided "AS IS" with no warranties, and confers no rights.
"Jitendra Kataria" <jeetu...@yahoo.com> wrote in message
news:0ba301c36bc3$da9f17c0$a401...@phx.gbl...
Best Wishes,,
Jeetu
>.
>