UINT WINAPI ImeToAsciiEx (UINT uVKey,UINT uScanCode,CONST LPBYTE lpbKeyState,LPDWORD lpdwTransKey,UINT fuState,HIMC hIMC)
{
LPARAM lParam;
LPINPUTCONTEXT lpIMC;
BOOL fOpen; DebugLog(1,(DebugLogFile,"ImeToAsciiEx\n")); lpdwCurTransKey = lpdwTransKey;
lParam = ((DWORD)uScanCode << 16) + 1L;
// Init uNumTransKey here.
uNumTransKey = 0; // if hIMC is NULL, this means DISABLE IME.
if (!hIMC)
return 0;
if (!(lpIMC = ImmLockIMC(hIMC)))
return 0;
fOpen = lpIMC->fOpen;
ImmUnlockIMC(hIMC); // The current status of IME is "closed".
if (!fOpen)
goto my_exit; if (uScanCode & 0x8000)
IMEKeyupHandler( hIMC, uVKey, lParam, lpbKeyState);
else
IMEKeydownHandler( hIMC, uVKey, lParam, lpbKeyState);
// Clear static value, no more generated message!
lpdwCurTransKey = NULL;my_exit: // If trans key buffer that is allocated by USER.EXE full up,
// the return value is the negative number.
if (fOverTransKey)
{
return (int)uNumTransKey;
} return (int)uNumTransKey;
}
{
LPARAM lParam;
LPINPUTCONTEXT lpIMC;
BOOL fOpen; DebugLog(1,(DebugLogFile,"ImeToAsciiEx\n")); lpdwCurTransKey = lpdwTransKey;
lParam = ((DWORD)uScanCode << 16) + 1L;
// Init uNumTransKey here.
uNumTransKey = 0; // if hIMC is NULL, this means DISABLE IME.
if (!hIMC)
return 0;
if (!(lpIMC = ImmLockIMC(hIMC)))
return 0;
fOpen = lpIMC->fOpen;
ImmUnlockIMC(hIMC); // The current status of IME is "closed".
if (!fOpen)
goto my_exit; if (uScanCode & 0x8000)
IMEKeyupHandler( hIMC, uVKey, lParam, lpbKeyState);
else
IMEKeydownHandler( hIMC, uVKey, lParam, lpbKeyState);
// Clear static value, no more generated message!
lpdwCurTransKey = NULL;my_exit: // If trans key buffer that is allocated by USER.EXE full up,
// the return value is the negative number.
if (fOverTransKey)
{
return (int)uNumTransKey;
} return (int)uNumTransKey;
}
http://msdn.microsoft.com/en-us/library/ms646281%28VS.85%29.aspx1L 的意思是那個鍵被按下了 1 次.
lParam = ((DWORD)uScanCode << 16) + 1; 直接1就可以了