| 1227 | #pragma warning(push) |
| 1228 | #pragma warning( disable : 4616 6305 ) |
| 1229 | _Use_decl_annotations_ |
| 1230 | LPARAM ImeUi_ProcessMessage( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM& lParam, bool* trapped ) |
| 1231 | { |
| 1232 | HIMC himc; |
| 1233 | int len; |
| 1234 | static LPARAM lAlt = 0x80000000, lCtrl = 0x80000000, lShift = 0x80000000; |
| 1235 | |
| 1236 | *trapped = false; |
| 1237 | if( !g_bInitialized || g_bDisableImeCompletely ) |
| 1238 | { |
| 1239 | return 0; |
| 1240 | } |
| 1241 | |
| 1242 | switch( uMsg ) |
| 1243 | { |
| 1244 | // |
| 1245 | // IME Handling |
| 1246 | // |
| 1247 | case WM_INPUTLANGCHANGE: |
| 1248 | OnInputLangChange(); |
| 1249 | break; |
| 1250 | |
| 1251 | case WM_IME_SETCONTEXT: |
| 1252 | // |
| 1253 | // We don't want anything to display, so we have to clear lParam and pass it to DefWindowProc(). |
| 1254 | // Expecially important in Vista to receive IMN_CHANGECANDIDATE correctly. |
| 1255 | // |
| 1256 | lParam = 0; |
| 1257 | break; |
| 1258 | |
| 1259 | case WM_IME_STARTCOMPOSITION: |
| 1260 | InitCompStringData(); |
| 1261 | *trapped = true; |
| 1262 | break; |
| 1263 | |
| 1264 | case WM_IME_COMPOSITION: |
| 1265 | { |
| 1266 | LONG lRet; |
| 1267 | TCHAR szCompStr[COUNTOF(g_szCompositionString)]; |
| 1268 | |
| 1269 | *trapped = true; |
| 1270 | himc = ImmGetContext( hWnd ); |
| 1271 | if( !himc ) |
| 1272 | { |
| 1273 | break; |
| 1274 | } |
| 1275 | |
| 1276 | // ResultStr must be processed before composition string. |
| 1277 | if( lParam & GCS_RESULTSTR ) |
| 1278 | { |
| 1279 | lRet = ( LONG )_ImmGetCompositionString( himc, GCS_RESULTSTR, szCompStr, |
| 1280 | COUNTOF( szCompStr ) ) / sizeof( TCHAR ); |
| 1281 | szCompStr[lRet] = 0; |
| 1282 | CancelCompString( g_hwndCurr, false, GetCharCount( szCompStr ) ); |
| 1283 | wcscpy_s( g_szCompositionString, COUNTOF(g_szCompositionString), szCompStr ); |
| 1284 | _SendCompString(); |
| 1285 | InitCompStringData(); |
| 1286 | } |
no test coverage detected