Implementing the KeybdPdd_GetEventEx2 Function (Windows CE 5.0)
In your Windows CE .NET 4.2 or later keyboard driver, replace the implementation of the KeybdPdd_GetEventEx function with an implementation of the KeybdPdd_GetEventEx2 function.
Perform the following steps in the files that contain the declaration and the implementation of the Windows CE .NET 4.1 or earlier KeybdPdd_GetEventEx function. Usually, these files are named Ps2keybd.hpp and Ps2keybd.cpp.
To implement the KeybdPdd_GetEventEx2 function
In the source file, replace the KeybdPdd_GetEventEx function implementation with the KeybdPdd_GetEventEx2 function implementation.
The following code example shows an implementation of KeybdPdd_GetEventEx2.
static UINT KeybdPdd_GetEventEx2( UINT uiPddId, UINT32 rguiScanCode[16], BOOL rgfKeyUp[16] ) { SETFNAME(_T("KeybdPdd_GetEventEx2")); UINT8 ui8ScanCode; UINT cEvents = 0; static UINT32 scInProgress; static UINT32 scPrevious; static BOOL fKeyUp; DEBUGCHK(rguiScanCode != NULL); DEBUGCHK(rgfKeyUp != NULL); v_pp2k->m_pp2p->KeybdDataRead(&ui8ScanCode); DEBUGMSG(ZONE_SCANCODES, (_T("%s: scan code 0x%08x, code in progress 0x%08x, previous 0x%08x\r\n"), pszFname, ui8ScanCode, scInProgress, scPrevious)); if (ui8ScanCode == 0xf0) { fKeyUp = TRUE; } else if (ui8ScanCode == scE0Extended) { scInProgress = 0xe000; } else if (ui8ScanCode == scE1Extended) { scInProgress = 0xe10000; } else if (scInProgress == 0xe10000) { scInProgress |= ui8ScanCode << 8; } else { scInProgress |= ui8ScanCode; if ((scInProgress == scPrevious) && (fKeyUp == FALSE)) { // mdd handles auto-repeat so ignore auto-repeats from keybd } else { // Not a repeated key. This is the real thing. // The Korean keyboard has two keys which generate a single // scan code when pressed. The keys do not auto-repeat or // generate a scan code on release. The scan codes are 0xf1 // and 0xf2. It does notlook like any other driver uses // the 0x71 or 0x72 scan code so it should be safe. // If it is one of the Korean keys, drop the previous scan code. // If we did not, the earlier check to ignore auto-repeating keys // would prevent this key from working twice in a row because the // key does not generate a scan code on release. if ( ( fKeyUp == TRUE ) || ( scInProgress == 0xf1 ) || ( scInProgress == 0xf2 ) ) { scPrevious = 0; } else { scPrevious = scInProgress; } rguiScanCode[cEvents] = scInProgress; rgfKeyUp[cEvents] = fKeyUp; ++cEvents; } scInProgress = 0; fKeyUp = FALSE; } return cEvents; }
In the header file, replace the declaration of KeybdPdd_GetEventEx with a declaration for KeybdPdd_GetEventEx2.
The following code example shows a sample declaration for KeybdPdd_GetEventEx2.
UINT WINAPI KeybdPdd_GetEventEx2( UINT uiPddId, UINT32 rguiScanCode[16], BOOL rgfKeyDown[16] );
For some hardware platforms, in the header file, you might need to add a declaration for the KeybdPdd_PowerHandler function, which is type defined as PFN_KEYBD_PDD_POWER_HANDLER.
The following code example shows a declaration for this function.
void KeybdPdd_PowerHandler( BOOL bOff );
See Also
Send Feedback on this topic to the authors