BOOL pymImmSetOpenStatus(HIMC hIMC, int fopen) { PyMFC_PROLOGUE(pymFormatMessage); { PyMFCLeavePython lp; return ImmSetOpenStatus(hIMC, fopen); } PyMFC_EPILOGUE(0); }
static void test_ImmMessages(void) { CANDIDATEFORM cf; imm_msgs *msg; HWND defwnd; HIMC imc; UINT idx = 0; HWND hwnd = CreateWindowEx(WS_EX_CLIENTEDGE, "EDIT", "Wine imm32.dll test", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 240, 120, NULL, NULL, GetModuleHandle(0), NULL); ShowWindow(hwnd, SW_SHOWNORMAL); defwnd = ImmGetDefaultIMEWnd(hwnd); imc = ImmGetContext(hwnd); ImmSetOpenStatus(imc, TRUE); msg_spy_flush_msgs(); SendMessage(defwnd, WM_IME_CONTROL, IMC_GETCANDIDATEPOS, (LPARAM)&cf ); do { msg = msg_spy_find_next_msg(WM_IME_CONTROL,&idx); if (msg) ok(!msg->post, "Message should not be posted\n"); } while (msg); msg_spy_flush_msgs(); ImmSetOpenStatus(imc, FALSE); ImmReleaseContext(hwnd, imc); DestroyWindow(hwnd); }
void IME_SetOpenStatus(BOOL fOpen) { HIMC imc; imc = RealIMC(FROM_X11); ImmSetOpenStatus(imc, fOpen); }
void imedel(){ //imeをオフ HIMC hImc; hImc = ImmGetContext( hWnd ); ImmSetOpenStatus(hImc, false); ImmReleaseContext(hWnd, hImc); }
// Set IME open state void CImeView::SetState(BOOL fOpen) { if (Enter()) { ImmSetOpenStatus(m_hIMC, fOpen); Leave(); } }
// &SetImeString static void funcSetImeString(HWND i_hwnd, int i_size) { _TCHAR *buf = new _TCHAR(i_size); DWORD len = 0; _TCHAR ImeDesc[GANA_MAX_ATOM_LENGTH]; UINT ImeDescLen; DWORD error; DWORD denom = 1; HANDLE hPipe = CreateFile(addSessionId(HOOK_PIPE_NAME).c_str(), GENERIC_READ, FILE_SHARE_READ, (SECURITY_ATTRIBUTES *)NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, (HANDLE)NULL); error = ReadFile(hPipe, buf, i_size, &len, NULL); CloseHandle(hPipe); ImeDescLen = ImmGetDescription(GetKeyboardLayout(0), ImeDesc, sizeof(ImeDesc)); if (_tcsncmp(ImeDesc, _T("SKKIME"), ImeDescLen) > 0) denom = sizeof(_TCHAR); HIMC hIMC = ImmGetContext(i_hwnd); if (hIMC == INVALID_HANDLE_VALUE) return; int status = ImmGetOpenStatus(hIMC); ImmSetCompositionString(hIMC, SCS_SETSTR, buf, len / denom, NULL, 0); delete buf; ImmNotifyIME(hIMC, NI_COMPOSITIONSTR, CPS_COMPLETE, 0); if (!status) ImmSetOpenStatus(hIMC, status); ImmReleaseContext(i_hwnd, hIMC); }
void close() { if(IsWindow(hwnd_)) { Context himc(hwnd_); ImmSetOpenStatus(himc, FALSE); is_open_ = ImmGetOpenStatus(himc) ? true : false; } }
bool open() { if(IsWindow(hwnd_)) { Context himc(hwnd_); ImmSetOpenStatus(himc, TRUE); is_open_ = ImmGetOpenStatus(himc) ? true : false; } return is_open_; }
static HRESULT WINAPI ActiveIMMApp_SetOpenStatus(IActiveIMMApp* This, HIMC hIMC, BOOL fOpen) { BOOL rc; rc = ImmSetOpenStatus(hIMC,fOpen); if (rc) return S_OK; else return E_FAIL; }
void IME_SetResultString(LPWSTR lpResult, DWORD dwResultLen) { HIMC imc; LPINPUTCONTEXT lpIMC; HIMCC newCompStr; LPIMEPRIVATE myPrivate; BOOL inComp; imc = RealIMC(FROM_X11); lpIMC = ImmLockIMC(imc); if (lpIMC == NULL) return; newCompStr = updateCompStr(lpIMC->hCompStr, NULL, 0); ImmDestroyIMCC(lpIMC->hCompStr); lpIMC->hCompStr = newCompStr; newCompStr = updateResultStr(lpIMC->hCompStr, lpResult, dwResultLen); ImmDestroyIMCC(lpIMC->hCompStr); lpIMC->hCompStr = newCompStr; myPrivate = ImmLockIMCC(lpIMC->hPrivate); inComp = myPrivate->bInComposition; ImmUnlockIMCC(lpIMC->hPrivate); if (!inComp) { ImmSetOpenStatus(imc, TRUE); GenerateIMEMessage(imc, WM_IME_STARTCOMPOSITION, 0, 0); } GenerateIMEMessage(imc, WM_IME_COMPOSITION, 0, GCS_COMPSTR); GenerateIMEMessage(imc, WM_IME_COMPOSITION, lpResult[0], GCS_RESULTSTR|GCS_RESULTCLAUSE); GenerateIMEMessage(imc, WM_IME_ENDCOMPOSITION, 0, 0); if (!inComp) ImmSetOpenStatus(imc, FALSE); ImmUnlockIMC(imc); }
/* IME 制御 */ BOOL SetImeOpenStatus(HWND hWnd, BOOL flg) { BOOL ret = FALSE; HIMC hImc; if ((hImc = ImmGetContext(hWnd))) { ret = ImmSetOpenStatus(hImc, flg); ImmReleaseContext(hWnd, hImc); } return ret; }
// &SetImeStatus static void funcSetImeStatus(HWND i_hwnd, int i_status) { HIMC hIMC; hIMC = ImmGetContext(i_hwnd); if (hIMC == INVALID_HANDLE_VALUE) return; if (i_status < 0) i_status = !ImmGetOpenStatus(hIMC); ImmSetOpenStatus(hIMC, i_status); ImmReleaseContext(i_hwnd, hIMC); }
BOOL SetNLSMode( HWND hWnd, HANDLE hConsole, DWORD fdwConversion ) { PCONSOLE_TABLE ConTbl; HIMC hIMC; ConTbl = SearchConsole(hConsole); if (ConTbl == NULL) { DBGPRINT(("CONIME: Error! Cannot found registed Console\n")); return FALSE; } if (fdwConversion & IME_CMODE_DISABLE) { ImmSetActiveContextConsoleIME(hWnd, FALSE) ; ImmAssociateContext(hWnd, (HIMC)NULL); ConTbl->hIMC_Current = (HIMC)NULL; } else { ImmAssociateContext(hWnd, ConTbl->hIMC_Original); ImmSetActiveContextConsoleIME(hWnd, TRUE) ; ConTbl->hIMC_Current = ConTbl->hIMC_Original; } hIMC = ImmGetContext( hWnd ) ; if ( hIMC == (HIMC)NULL ) return TRUE; ConTbl->fOpen =(fdwConversion & IME_CMODE_OPEN) ? TRUE : FALSE ; ImmSetOpenStatus(hIMC, ConTbl->fOpen); fdwConversion &= ~(IME_CMODE_DISABLE | IME_CMODE_OPEN); if (ConTbl->dwConversion != fdwConversion) { ConTbl->dwConversion = fdwConversion; ImmSetConversionStatus(hIMC, ConTbl->dwConversion, ConTbl->dwSentence ); } ImmReleaseContext( hWnd, hIMC ); return TRUE; }
static void test_ImmDefaultHwnd(void) { HIMC imc1, imc2, imc3; HWND def1, def3; HWND hwnd; hwnd = CreateWindowEx(WS_EX_CLIENTEDGE, "EDIT", "Wine imm32.dll test", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 240, 120, NULL, NULL, GetModuleHandle(0), NULL); ShowWindow(hwnd, SW_SHOWNORMAL); imc1 = ImmGetContext(hwnd); if (!imc1) { win_skip("IME support not implemented\n"); return; } def1 = ImmGetDefaultIMEWnd(hwnd); imc2 = ImmCreateContext(); ImmSetOpenStatus(imc2, TRUE); imc3 = ImmGetContext(hwnd); def3 = ImmGetDefaultIMEWnd(hwnd); ok(def3 == def1, "Default IME window should not change\n"); ok(imc1 == imc3, "IME context should not change\n"); ImmSetOpenStatus(imc2, FALSE); ImmReleaseContext(hwnd, imc1); ImmReleaseContext(hwnd, imc3); ImmDestroyContext(imc2); DestroyWindow(hwnd); }
/************************************************************************ * * SteIMEOpenClose - This routines calls IMM API to open or close IME. * ************************************************************************/ void SteImeOpenClose( HWND hWnd, BOOL fFlag ) { HIMC hIMC; // // If fFlag is true then open IME; otherwise close it. // if ( !( hIMC = ImmGetContext( hWnd ) ) ) return; ImmSetOpenStatus( hIMC, fFlag ); ImmReleaseContext( hWnd, hIMC ); }
static int ui_ime_set_ime(lua_State* L) { HWND hwnd; HIMC himc; BOOL is_open; Crj_ParseArgs(L, "| Q", &is_open); hwnd = GetForegroundWindow(); himc = ImmGetContext(hwnd); ImmSetOpenStatus(himc, is_open); ImmReleaseContext(hwnd, himc); return 0; }
LRESULT CALLBACK MainWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { FARPROC lpProc = NULL; RECT rect = {0}; HMENU hMenu = NULL; HIMC hIMC = NULL; BOOL fOpen = FALSE; switch (message) { case WM_CREATE: // Create Status Window CreateTBar(hWnd); CreateStatus(hWnd); // Create Child Window GetClientRect(hWnd, &rect); if (!(hWndCompStr = CreateWindowEx(WS_EX_CLIENTEDGE, TEXT("CompStrWndClass"), NULL, WS_CHILD | WS_VISIBLE, // 0, 0, rect.right, rect.bottom - nStatusHeight, 0, 0, 0, 0, hWnd, NULL, hInst, NULL))) return FALSE; InitIMEUIPosition(hWndCompStr); if (!(hWndCandList = CreateWindowEx(WS_EX_CLIENTEDGE, TEXT("CandListWndClass"), NULL, WS_CHILD | WS_VISIBLE, 0, 0, 0, 0, hWnd, NULL, hInst, NULL))) return FALSE; ShowWindow(hWndCompStr, SW_SHOW); ShowWindow(hWndCandList, SW_SHOWNA); SetStatusItems(hWnd); hMenu = GetMenu(hWnd); CheckMenuItem(hMenu,IDM_SHOWCAND, (fShowCand ? MF_CHECKED : MF_UNCHECKED)); break; case WM_COMMAND: switch(LOWORD(wParam)) { case IDM_ABOUT: lpProc = (FARPROC)MakeProcInstance(AboutDlg, hInst); DialogBox(hInst, TEXT("ABOUTBOX"), hWnd, (DLGPROC)lpProc); FreeProcInstance(lpProc); break; case IDM_FONT: { CHOOSEFONT cf = {0}; LOGFONT lfT = {0}; /* Set all structure fields to zero. */ memset(&cf, 0, sizeof(CHOOSEFONT)); memcpy(&lfT, &lf, sizeof(LOGFONT)); cf.lStructSize = sizeof(CHOOSEFONT); cf.hwndOwner = hWnd; cf.lpLogFont = &lfT; cf.Flags = CF_SCREENFONTS | CF_EFFECTS; cf.nFontType = SCREEN_FONTTYPE; if (ChooseFont(&cf)) { if (hFont) { DeleteObject(hFont); } memcpy(&lf, &lfT, sizeof(LOGFONT)); hFont = CreateFontIndirect(&lf); InvalidateRect(hWndCompStr,NULL,TRUE); UpdateWindow(hWndCompStr); } } break; case IDM_SHOWCAND: hMenu = GetMenu(hWnd); fShowCand = !fShowCand; CheckMenuItem(hMenu,IDM_SHOWCAND, (fShowCand ? MF_CHECKED : MF_UNCHECKED)); MoveCompCandWindow(hWnd); UpdateShowCandButton(); break; case IDM_OPENSTATUS: hIMC = ImmGetContext(hWndCompStr); fOpen = ImmGetOpenStatus(hIMC); ImmSetOpenStatus(hIMC,!fOpen); UpdateShowOpenStatusButton(!fOpen); ImmReleaseContext(hWndCompStr,hIMC); hMenu = GetMenu(hWnd); CheckMenuItem(hMenu,IDM_OPENSTATUS, (fOpen ? MF_UNCHECKED : MF_CHECKED)); break; case IDM_NATIVEMODE: /* fall-through */ case IDM_FULLHALF: /* fall-through */ case IDM_ROMAN: /* fall-through */ case IDM_CHARCODE: /* fall-through */ case IDM_HANJA: /* fall-through */ case IDM_SOFTKBD: /* fall-through */ case IDM_EUDC: /* fall-through */ case IDM_SYMBOL: HandleModeCommand(hWnd,wParam,lParam); break; case IDM_CONVERT: /* fall-through */ case IDM_CANCEL: /* fall-through */ case IDM_REVERT: /* fall-through */ case IDM_COMPLETE: /* fall-through */ case IDM_OPENCAND: /* fall-through */ case IDM_CLOSECAND: /* fall-through */ case IDM_NEXTCAND: /* fall-through */ case IDM_PREVCAND: HandleConvertCommand(hWnd,wParam,lParam); break; case IDM_NEXTCLAUSE: /* fall-through */ case IDM_PREVCLAUSE: HandleChangeAttr(hWnd,(LOWORD(wParam) == IDM_NEXTCLAUSE)); break; default: break; } break; case WM_SETFOCUS: SetFocus(hWndCompStr); break; case WM_NOTIFY: SetTooltipText(hWnd, lParam); break; case WM_SIZE: SendMessage(hWndStatus,message,wParam,lParam); SendMessage(hWndToolBar,message,wParam,lParam); if (wParam != SIZE_MINIMIZED) { MoveCompCandWindow(hWnd); } break; case WM_IME_NOTIFY: switch (wParam) { case IMN_OPENSTATUSWINDOW: /* fall-through */ case IMN_CLOSESTATUSWINDOW: break; case IMN_SETCONVERSIONMODE: return (DefWindowProc(hWnd, message, wParam, lParam)); } break; case WM_DESTROY: if (hFont) { DeleteObject(hFont); } PostQuitMessage(0); break; default: return (DefWindowProc(hWnd, message, wParam, lParam)); } return 0L; }
/// hook of SendMessage LRESULT CALLBACK callWndProc(int i_nCode, WPARAM i_wParam, LPARAM i_lParam) { if (!g.m_isInitialized) initialize(false); if (!g_hookData) return 0; CWPSTRUCT &cwps = *(CWPSTRUCT *)i_lParam; if (0 <= i_nCode) { switch (cwps.message) { case WM_ACTIVATEAPP: case WM_NCACTIVATE: if (i_wParam) notifySetFocus(); break; case WM_SYSCOMMAND: switch (cwps.wParam) { case SC_MAXIMIZE: case SC_MAXIMIZE2: updateShow(cwps.hwnd, NotifyShow::Show_Maximized); break; case SC_MINIMIZE: case SC_MINIMIZE2: updateShow(cwps.hwnd, NotifyShow::Show_Minimized); break; case SC_RESTORE: case SC_RESTORE2: updateShow(cwps.hwnd, NotifyShow::Show_Normal); break; default: break; } /* through below */ case WM_COMMAND: notifyCommand(cwps.hwnd, cwps.message, cwps.wParam, cwps.lParam); break; case WM_SIZE: switch (cwps.wParam) { case SIZE_MAXIMIZED: updateShow(cwps.hwnd, NotifyShow::Show_Maximized); break; case SIZE_MINIMIZED: updateShow(cwps.hwnd, NotifyShow::Show_Minimized); break; case SIZE_RESTORED: updateShow(cwps.hwnd, NotifyShow::Show_Normal); break; default: break; } break; case WM_MOUSEACTIVATE: notifySetFocus(); break; case WM_ACTIVATE: if (LOWORD(cwps.wParam) != WA_INACTIVE) { notifySetFocus(); if (HIWORD(cwps.wParam)) { // check minimized flag // minimized flag on notifyShow(NotifyShow::Show_Minimized, false); //notifyShow(NotifyShow::Show_Normal, true); } } break; case WM_ENTERMENULOOP: g.m_isInMenu = true; notifySetFocus(true); break; case WM_EXITMENULOOP: g.m_isInMenu = false; notifySetFocus(true); break; case WM_SETFOCUS: g.m_isInMenu = false; // for kana if (g_hookData->m_correctKanaLockHandling) { if (HIMC hIMC = ImmGetContext(cwps.hwnd)) { bool status = !!ImmGetOpenStatus(hIMC); // this code set the VK_KANA state correctly. ImmSetOpenStatus(hIMC, !status); ImmSetOpenStatus(hIMC, status); ImmReleaseContext(cwps.hwnd, hIMC); } } notifySetFocus(); notifyLockState(5); break; case WM_IME_STARTCOMPOSITION: g.m_isImeCompositioning = true; notifyLockState(6); break; case WM_IME_ENDCOMPOSITION: g.m_isImeCompositioning = false; notifyLockState(7); break; case WM_IME_NOTIFY: if (cwps.wParam == IMN_SETOPENSTATUS) if (HIMC hIMC = ImmGetContext(cwps.hwnd)) { g.m_isImeLock = !!ImmGetOpenStatus(hIMC); ImmReleaseContext(cwps.hwnd, hIMC); notifyLockState(8); } break; } } return CallNextHookEx(s_hookDataArch->m_hHookCallWndProc, i_nCode, i_wParam, i_lParam); }
/** * ダイアログのプロシージャ。 * @param [in] hDlg ダイアログボックスのハンドルが格納されています * @param [in] uMsg メッセージが格納されています * @param [in] wParam メッセージの追加情報が格納されています * @param [in] lParam メッセージの追加情報が格納されています * @return メッセージを処理した場合は 0 以外(TRUE)、そうでなければ 0(FALSE) */ static BOOL CALLBACK DialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { static HWND hwndComboBox = NULL; static HWND hwndEdit = NULL; static LRESULT selectedIndex = CB_ERR; static int length = 0; char *imeControl = NULL; switch (uMsg) { case WM_INITDIALOG: center_window(hDlg); hwndComboBox = GetDlgItem(hDlg, IDC_COMBO1); SendMessage(hwndComboBox, CB_LIMITTEXT, 0, 0); hwndEdit = GetWindow(hwndComboBox, GW_CHILD); SetFocus(hwndComboBox); SetFocus(GetDlgItem(hDlg, IDC_COMBO1)); for (unsigned int i = 0; i < history.size(); i++) { SendMessage(hwndComboBox, CB_INSERTSTRING, i, (LPARAM)history[i].c_str()); } CheckRadioButton(hDlg, IDC_RADIO1, IDC_RADIO4, selectedRadioButton); CheckDlgButton(hDlg, IDC_CHECK1, selectedCheckBox); if (selectedRadioButton == IDC_RADIO1 || selectedRadioButton == IDC_RADIO2) { EnableWindow(GetDlgItem(hDlg, IDC_CHECK1), FALSE); } if (selectedText.size() != 0) { SetWindowText(hwndEdit, selectedText.c_str()); } if ((imeControl = iniFile->read("IME", "control")) && strcmp(imeControl, "1") == 0) { HIMC hImc; DWORD dwConv, dwSent; hImc = ImmGetContext(hDlg); ImmGetConversionStatus(hImc, &dwConv, &dwSent); if (ImmGetOpenStatus(hImc)) { ImmSetOpenStatus(hImc, false); } ImmReleaseContext(hDlg, hImc); } // SetFocus でフォーカス移動を行った場合は FALSE を返さなければならない return FALSE; case WM_COMMAND: switch (LOWORD(wParam)) { case IDCANCEL: EndDialog(hDlg, IDCANCEL); return TRUE; case IDOK: if (IsDlgButtonChecked(hDlg, IDC_RADIO1)) { selectedRadioButton = IDC_RADIO1; } else if (IsDlgButtonChecked(hDlg, IDC_RADIO2)) { selectedRadioButton = IDC_RADIO2; } else if (IsDlgButtonChecked(hDlg, IDC_RADIO3)) { selectedRadioButton = IDC_RADIO3; } else if (IsDlgButtonChecked(hDlg, IDC_RADIO4)) { selectedRadioButton = IDC_RADIO4; } selectedCheckBox = IsDlgButtonChecked(hDlg, IDC_CHECK1); // 設定ファイルに状態を書き出す switch (selectedRadioButton) { case IDC_RADIO1: iniFile->write("Config", "radio", "1"); break; case IDC_RADIO2: iniFile->write("Config", "radio", "2"); break; case IDC_RADIO3: iniFile->write("Config", "radio", "3"); break; case IDC_RADIO4: iniFile->write("Config", "radio", "4"); break; default: iniFile->write("Config", "radio", "1"); break; } if (selectedCheckBox) { iniFile->write("Config", "check", "TRUE"); } else { iniFile->write("Config", "check", "FALSE"); } // 履歴を保存 length = GetWindowTextLength(hwndEdit); if (length != 0) { char *buf = new char[length + 1]; buf[length] = '\0'; GetWindowText(hwndEdit, buf, length + 1); std::string temp = buf; delete[] buf; history.insert(history.begin(), temp); for (unsigned int i = 0; i < history.size() - 1; i++) { for (unsigned int j = i + 1; j < history.size(); j++) { std::string str1 = history[i]; std::string str2 = history[j]; if (str1 == str2) { history[j] = ""; } } } int index = 0; for (unsigned int i = 0; i < MAX_HISTORY && i < history.size(); i++) { if (history[i] != "") { std::string key = "history"; char num[3] = {0}; sprintf_s(num, "%d", index); key += num; iniFile->write("History", key.c_str(), history[i].c_str()); index++; } } } if (length != 0) { EndDialog(hDlg, IDOK); } else { EndDialog(hDlg, IDCANCEL); } return TRUE; case IDC_RADIO1: case IDC_RADIO2: CheckRadioButton(hDlg, IDC_RADIO1, IDC_RADIO4, LOWORD(wParam)); EnableWindow(GetDlgItem(hDlg, IDC_CHECK1), FALSE); return TRUE; case IDC_RADIO3: case IDC_RADIO4: CheckRadioButton(hDlg, IDC_RADIO1, IDC_RADIO4, LOWORD(wParam)); EnableWindow(GetDlgItem(hDlg, IDC_CHECK1), TRUE); return TRUE; case IDC_COMBO1: switch (HIWORD(wParam)) { case CBN_SELCHANGE: // 選択項目が変更されたとき case CBN_EDITUPDATE: // 直接入力で内容が変更されたとき。変更内容が表示される前に呼ばれる case CBN_EDITCHANGE: // 直接入力で内容が変更されたとき。変更内容が表示された後に呼ばれる selectedIndex = SendMessage(hwndComboBox, CB_GETCURSEL, 0, 0); break; } break; default: break; } return FALSE; case WM_TIMER: return FALSE; case WM_CLOSE: EndDialog(hDlg, WM_CLOSE); return TRUE; default: break; } return FALSE; }
static void test_ImmThreads(void) { HIMC himc, otherHimc, h1; igc_threadinfo threadinfo; HANDLE hThread; DWORD dwThreadId; BOOL rc; LOGFONT lf; COMPOSITIONFORM cf; DWORD status, sentence; POINT pt; himc = ImmGetContext(hwnd); threadinfo.event = CreateEvent(NULL, TRUE, FALSE, NULL); threadinfo.himc = himc; hThread = CreateThread(NULL, 0, ImmGetContextThreadFunc, &threadinfo, 0, &dwThreadId ); WaitForSingleObject(threadinfo.event, INFINITE); otherHimc = ImmGetContext(threadinfo.hwnd); todo_wine ok(himc != otherHimc, "Windows from other threads should have different himc\n"); todo_wine ok(otherHimc == threadinfo.himc, "Context from other thread should not change in main thread\n"); if (0) /* FIXME: Causes wine to hang */ { h1 = ImmAssociateContext(hwnd,otherHimc); ok(h1 == NULL, "Should fail to be able to Associate a default context from a different thread\n"); h1 = ImmGetContext(hwnd); ok(h1 == himc, "Context for window should remain unchanged\n"); ImmReleaseContext(hwnd,h1); } /* OpenStatus */ rc = ImmSetOpenStatus(himc, TRUE); ok(rc != 0, "ImmSetOpenStatus failed\n"); rc = ImmGetOpenStatus(himc); ok(rc != 0, "ImmGetOpenStatus failed\n"); rc = ImmSetOpenStatus(himc, FALSE); ok(rc != 0, "ImmSetOpenStatus failed\n"); rc = ImmGetOpenStatus(himc); ok(rc == 0, "ImmGetOpenStatus failed\n"); rc = ImmSetOpenStatus(otherHimc, TRUE); todo_wine ok(rc == 0, "ImmSetOpenStatus should fail\n"); rc = ImmGetOpenStatus(otherHimc); todo_wine ok(rc == 0, "ImmGetOpenStatus failed\n"); rc = ImmSetOpenStatus(otherHimc, FALSE); todo_wine ok(rc == 0, "ImmSetOpenStatus should fail\n"); rc = ImmGetOpenStatus(otherHimc); ok(rc == 0, "ImmGetOpenStatus failed\n"); /* CompositionFont */ rc = ImmGetCompositionFont(himc, &lf); ok(rc != 0, "ImmGetCompositionFont failed\n"); rc = ImmSetCompositionFont(himc, &lf); ok(rc != 0, "ImmSetCompositionFont failed\n"); rc = ImmGetCompositionFont(otherHimc, &lf); ok(rc != 0 || broken(rc == 0), "ImmGetCompositionFont failed\n"); rc = ImmSetCompositionFont(otherHimc, &lf); todo_wine ok(rc == 0, "ImmSetCompositionFont should fail\n"); /* CompositionWindow */ rc = ImmSetCompositionWindow(himc, &cf); ok(rc != 0, "ImmSetCompositionWindow failed\n"); rc = ImmGetCompositionWindow(himc, &cf); ok(rc != 0, "ImmGetCompositionWindow failed\n"); rc = ImmSetCompositionWindow(otherHimc, &cf); todo_wine ok(rc == 0, "ImmSetCompositionWindow should fail\n"); rc = ImmGetCompositionWindow(otherHimc, &cf); ok(rc != 0 || broken(rc == 0), "ImmGetCompositionWindow failed\n"); /* ConversionStatus */ rc = ImmGetConversionStatus(himc, &status, &sentence); ok(rc != 0, "ImmGetConversionStatus failed\n"); rc = ImmSetConversionStatus(himc, status, sentence); ok(rc != 0, "ImmSetConversionStatus failed\n"); rc = ImmGetConversionStatus(otherHimc, &status, &sentence); ok(rc != 0 || broken(rc == 0), "ImmGetConversionStatus failed\n"); rc = ImmSetConversionStatus(otherHimc, status, sentence); todo_wine ok(rc == 0, "ImmSetConversionStatus should fail\n"); /* StatusWindowPos */ rc = ImmSetStatusWindowPos(himc, &pt); ok(rc != 0, "ImmSetStatusWindowPos failed\n"); rc = ImmGetStatusWindowPos(himc, &pt); ok(rc != 0, "ImmGetStatusWindowPos failed\n"); rc = ImmSetStatusWindowPos(otherHimc, &pt); todo_wine ok(rc == 0, "ImmSetStatusWindowPos should fail\n"); rc = ImmGetStatusWindowPos(otherHimc, &pt); ok(rc != 0 || broken(rc == 0), "ImmGetStatusWindowPos failed\n"); ImmReleaseContext(threadinfo.hwnd,otherHimc); ImmReleaseContext(hwnd,himc); DestroyWindow(threadinfo.hwnd); TerminateThread(hThread, 1); himc = ImmGetContext(GetDesktopWindow()); todo_wine ok(himc == NULL, "Should not be able to get himc from other process window\n"); }
static void test_ime_processkey(void) { WCHAR classNameW[] = {'P','r','o','c','e','s','s', 'K','e','y','T','e','s','t','C','l','a','s','s',0}; WCHAR windowNameW[] = {'P','r','o','c','e','s','s', 'K','e','y',0}; MSG msg; WNDCLASSW wclass; HANDLE hInstance = GetModuleHandleW(NULL); TEST_INPUT inputs[2]; HIMC imc; INT rc; HWND hWndTest; wclass.lpszClassName = classNameW; wclass.style = CS_HREDRAW | CS_VREDRAW; wclass.lpfnWndProc = processkey_wnd_proc; wclass.hInstance = hInstance; wclass.hIcon = LoadIcon(0, IDI_APPLICATION); wclass.hCursor = LoadCursor( NULL, IDC_ARROW); wclass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); wclass.lpszMenuName = 0; wclass.cbClsExtra = 0; wclass.cbWndExtra = 0; if(!RegisterClassW(&wclass)){ win_skip("Failed to register window.\n"); return; } /* create the test window that will receive the keystrokes */ hWndTest = CreateWindowW(wclass.lpszClassName, windowNameW, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0, 100, 100, NULL, NULL, hInstance, NULL); ShowWindow(hWndTest, SW_SHOW); SetWindowPos(hWndTest, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE); SetForegroundWindow(hWndTest); UpdateWindow(hWndTest); imc = ImmGetContext(hWndTest); if (!imc) { win_skip("IME not supported\n"); DestroyWindow(hWndTest); return; } rc = ImmSetOpenStatus(imc, TRUE); if (rc != TRUE) { win_skip("Unable to open IME\n"); ImmReleaseContext(hWndTest, imc); DestroyWindow(hWndTest); return; } /* flush pending messages */ while (PeekMessageW(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageW(&msg); SetFocus(hWndTest); /* init input data that never changes */ inputs[1].type = inputs[0].type = INPUT_KEYBOARD; inputs[1].u.ki.dwExtraInfo = inputs[0].u.ki.dwExtraInfo = 0; inputs[1].u.ki.time = inputs[0].u.ki.time = 0; /* Pressing a key */ inputs[0].u.ki.wVk = 0x41; inputs[0].u.ki.wScan = 0x1e; inputs[0].u.ki.dwFlags = 0x0; pSendInput(1, (INPUT*)inputs, sizeof(INPUT)); while(PeekMessageW(&msg, hWndTest, 0, 0, PM_NOREMOVE)) { if(msg.message != WM_KEYDOWN) PeekMessageW(&msg, hWndTest, 0, 0, PM_REMOVE); else { ok(msg.wParam != VK_PROCESSKEY,"Incorrect ProcessKey Found\n"); PeekMessageW(&msg, hWndTest, 0, 0, PM_REMOVE); if(msg.wParam == VK_PROCESSKEY) trace("ProcessKey was correctly found\n"); } TranslateMessage(&msg); DispatchMessageW(&msg); } inputs[0].u.ki.wVk = 0x41; inputs[0].u.ki.wScan = 0x1e; inputs[0].u.ki.dwFlags = KEYEVENTF_KEYUP; pSendInput(1, (INPUT*)inputs, sizeof(INPUT)); while(PeekMessageW(&msg, hWndTest, 0, 0, PM_NOREMOVE)) { if(msg.message != WM_KEYUP) PeekMessageW(&msg, hWndTest, 0, 0, PM_REMOVE); else { ok(msg.wParam != VK_PROCESSKEY,"Incorrect ProcessKey Found\n"); PeekMessageW(&msg, hWndTest, 0, 0, PM_REMOVE); ok(msg.wParam != VK_PROCESSKEY,"ProcessKey should still not be Found\n"); } TranslateMessage(&msg); DispatchMessageW(&msg); } ImmReleaseContext(hWndTest, imc); ImmSetOpenStatus(imc, FALSE); DestroyWindow(hWndTest); }