void JIme::SetImeMode(const DWORD mode) { HWND hWnd = JMain::GetInstance().GetJWindow().GetWindowHandle(); HIMC hImc = ImmGetContext(hWnd); DWORD dwConv, dwSent; ImmGetConversionStatus(hImc, &dwConv, &dwSent); ImmSetConversionStatus(hImc, mode, dwSent); ImmReleaseContext(hWnd, hImc); }
static HRESULT WINAPI ActiveIMMApp_SetConversionStatus(IActiveIMMApp* This, HIMC hIMC, DWORD fdwConversion, DWORD fdwSentence) { BOOL rc; rc = ImmSetConversionStatus(hIMC,fdwConversion,fdwSentence); if (rc) return S_OK; else return E_FAIL; }
void CEmoticonRichEditCtrl::SetHan(BOOL bFlag) { HIMC hIMC; hIMC = ImmGetContext(m_hWnd); if( hIMC == NULL ) return; if( ImmSetConversionStatus(hIMC, bFlag, IME_SMODE_NONE) == 0 ) return; if( ImmReleaseContext(m_hWnd, hIMC) == 0 ) return; }
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; }
void Mint::SetHWND(HWND hWnd) { m_hWnd = hWnd; // ime status âÀ» hideÇÑ´Ù HWND imehwnd=ImmGetDefaultIMEWnd(Mint::GetInstance()->GetHWND()); LRESULT lr=SendMessage(imehwnd,WM_IME_CONTROL ,IMC_CLOSESTATUSWINDOW,0); _ASSERT(lr==0); HIMC hImc; hImc = ImmGetContext(Mint::GetInstance()->GetHWND()); if (hImc) { // Get current IME status DWORD dwIMEConvMode, dwSentMode; ImmGetConversionStatus(hImc, &dwIMEConvMode, &dwSentMode); ImmSetConversionStatus(hImc,IME_CMODE_ALPHANUMERIC, dwSentMode); Mint::EnableIME(false); } }
void CImeView::ConvInputMode() { ImmSetConversionStatus(m_hIMC,IME_CMODE_CHARCODE,IME_CMODE_NATIVE); }
LRESULT CALLBACK EditCtlProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam) { LPCTSTR lpTable, lpTable1; TCHAR c; #ifdef FAREAST TCHAR ch, chHW; #endif // FAREAST HKL hkl = GetKeyboardLayout(0); ASSERT(oldEditCtlProc); switch (message) { case WM_PASTE : { BOOL bPassThrough = TRUE; if (IsNumericOnlyEdit(hwnd)) { // only going to accept pastes that have pure numeric data in them HANDLE hMem; if(OpenClipboard(hwnd)) { hMem = GetClipboardData(CF_UNICODETEXT); if(hMem) { TCHAR *pText = (TCHAR *)LocalLock(hMem); // can't fail on CE int iLen = _tcslen(pText); int iPos = 0; for (iPos = 0; (iPos < iLen) && bPassThrough; iPos++) { if (!_istdigit(pText[iPos])) { // bad char bPassThrough = FALSE; } } LocalUnlock(hMem); } CloseClipboard(); } } if (bPassThrough) { return CallWindowProc(oldEditCtlProc,hwnd, message, wParam, lParam); } else { MessageBeep(MB_OK); return FALSE; } } break; case WM_IME_COMPOSITION: if( ImmIsIME(hkl ) && LOWORD(hkl ) == MAKELANGID(LANG_KOREAN, SUBLANG_DEFAULT)) { HIMC himc = ImmGetContext(hwnd); if (himc) { TCHAR szTempStr[4]; if (0<ImmGetCompositionString(himc,GCS_COMPSTR, szTempStr, 4)) { DWORD fdwConversion; DWORD fdwSentence; ImmNotifyIME(himc,NI_COMPOSITIONSTR,CPS_CANCEL,0); ImmGetConversionStatus(himc, &fdwConversion, &fdwSentence); fdwConversion&=(~IME_CMODE_NATIVE); ImmSetConversionStatus(himc,fdwConversion, fdwSentence); } ImmReleaseContext(hwnd,himc); return CallWindowProc(oldEditCtlProc,hwnd, message, wParam, lParam); } } break; case WM_CHAR: #ifdef FAREAST // Convert full-width numbers to half width ch = (TCHAR)wParam; LCMapString(LOCALE_USER_DEFAULT, LCMAP_HALFWIDTH, &ch, 1, &chHW, 1); wParam = (WPARAM)chHW; #endif // FAREAST // This character is not ASCII. If your country/region needs specific characters. You // have to change this. Otherwise, we abandon this character. if (wParam >= 0x80 ) { // service on ilegal chars MessageBeep(MB_OK); return TRUE; } if (wParam < VK_SPACE || wParam > 0x7e ) { // service on legal chars //DPF("None ascii char. ignore \r\n "); break; } if ((lpTable = GetTable(hwnd)) == NULL) { // DPF("Can not find table, trying parent \r\n"); if ((lpTable = GetTable(GetParent(hwnd))) == NULL) { //DPF("Can not find table, \r\n"); break; } } lpTable1 = lpTable; if (wParam >= '0' && wParam <= '9') goto found; while ((c = *lpTable++) > 0) { if ((TCHAR)wParam == c) goto found; } // now try w/ upper case if (iswlower((TCHAR)wParam)) { wParam = (LPARAM)towupper((TCHAR)wParam); while ((c = *lpTable1++) > 0) { if ((TCHAR)wParam == c) goto found; } } //DPF1("Char '%c' not in table\r\n", wParam); MessageBeep(MB_OK); return TRUE; found: //DPF1("Found char '%c' in table\r\n", wParam); break; default: break; } // of switch return CallWindowProc(oldEditCtlProc, hwnd, message, wParam, lParam); }
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"); }
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevinstance, LPSTR lpszCmdParam, int nCmdShow) { if(FindWindow(szWindowClass, szTitle) != NULL) { //ÀÌ¹Ì ½ÇÇàÁßÀ̸é MessageBox(NULL, _TEXT("ÀÌ¹Ì OpenWorld°¡ ½ÇÇàÁßÀÔ´Ï´Ù."), szTitle, MB_OK); return 0; } ApplicationLogger.write("OpenWorld started."); ApplicationLogger.write("Application version: %s\n", VERSION); //ÅؽºÆ® ¿¡µ÷ ÄÁÆ®·Ñ proc º¯°æ GetClassInfo(NULL, "edit", &EditWndClass); EditOrigWndProc = (WNDPROC)EditWndClass.lpfnWndProc; EditWndClass.lpfnWndProc = EditWndProc; EditWndClass.hInstance = hInst; EditWndClass.lpszClassName = "Edit"; //À©µµ¿ì Ŭ·¡½º µî·Ï WndClassRegister(hInstance); RegisterClass((LPWNDCLASS)&EditWndClass); ApplicationLogger.write("Configure display option..."); Option.OptionFile(".\\configure.ini"); if(Option.getOptionByInt("OpenWorld", "window_mode") == -1) { //ini ÆÄÀÏÀÌ ´©¶ôµÇ¾ú°Å³ª ÇÊµå ¶Ç´Â ¿É¼Ç ¼³Á¤¿¡ ¿À·ù°¡ Àִ°æ¿ì isWindowMode = 0; ApplicationLogger.write("Coudn't loaded window mode ini value - default set: 0"); } else { isWindowMode = Option.getOptionByInt("OpenWorld", "window_mode"); if(isWindowMode < 0 || isWindowMode > 1) { //0 ¶Ç´Â 1 ÀÌ¿ÜÀÇ °ªÀ¸·Î ¼³Á¤µÇÀÖ´Â °æ¿ì isWindowMode = 0; ApplicationLogger.write("window mode ini value has wrong value. default set: 0"); } } ScreenWidth = Option.getOptionByInt("OpenWorld", "width"); ScreenHeight = Option.getOptionByInt("OpenWorld", "height"); if(ScreenWidth < 1 || ScreenHeight < 1) { ApplicationLogger.write("Display setting has wrong value. - default set: width=1024, height=768"); MessageBox(NULL, "configure.ini ³» width ¶Ç´Â height °ªÀÌ À߸ø ¼³Á¤µÇ¾î ÀÖ½À´Ï´Ù.\n±âº»°ªÀÎ width=1024, height=768 ·Î Àç¼³Á¤ µÇ¾î ½ÇÇàµË´Ï´Ù.", "OpenWorld", MB_OK); Option.setOptionByInt("OpenWorld", "width", 1024); Option.setOptionByInt("OpenWorld", "height", 768); ScreenWidth = 1024; ScreenHeight = 768; } if(!InitWindowsForm(hInstance, nCmdShow, isWindowMode)) { //false ¸¦ ¸®ÅϹÞÀº °æ¿ì MessageBox(NULL, "OpenWorld âÀÇ ÃʱâÈ¿¡ ½ÇÆÐÇÏ¿´½À´Ï´Ù.", szTitle, MB_OK); return 0; } int Start_Time = 0, End_Time = 0, Frame_Time = 0; InitEngine(); //ÀÎÆ®·Î while(Quit != 1) { MessageProcess(); if(LogoIntro()) //·Î°í Ãâ·ÂÀÌ ³¡³ª¸é break; } //¸ÞÀΰÔÀÓ while(Quit != 1) { MessageProcess(); //¸ÞÀÎÇÚµéÀ϶§´Â ¹«Á¶°Ç IME¸¦ ¿µ¾î·Î ¼³Á¤(¾È±×·¯¸é ÇѱÛÅ° ´·ÁÀÖ¾î¼ z °°Àº ½ºÅ³Å° ¾È³ª°¨) if(GetFocus() == hWndMain) ImmSetConversionStatus(ImmGetContext(hWndMain), IME_CMODE_ALPHANUMERIC, (DWORD)0); if(Frame_Time == 0) Frame_Time = 1; UpdateEngineStatus(Frame_Time); End_Time = clock(); Frame_Time = End_Time - Start_Time; Start_Time = End_Time; } CloseEngine(); #ifdef DEBUG ShowWindow(hWndMain, SW_HIDE); system("pause"); #endif return 0; }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // CCUI dialog INT_PTR CALLBACK CCUI(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { TCHAR tzStr[MAX_STR]; STATIC CeleMenuBar s_mb; _HandleActivate(hWnd, uMsg, wParam, lParam); switch (uMsg) { case WM_INITDIALOG: g_hWnd = hWnd; s_mb = CeleCtrl::InitDlgBar(hWnd, IDR_MainMenu, TRUE); SetDlgItemText(hWnd, IDC_Path, (PCTSTR) lParam); return TRUE; case WM_SIZE: CeleCtrl::ReSize(hWnd, IDC_Log, lParam); CeleCtrl::ReWidth(hWnd, IDC_Tip, LOWORD(lParam)); CeleCtrl::ReWidth(hWnd, IDC_Path, CeleCtrl::ReLeft(hWnd, IDC_Browse, LOWORD(lParam))); break; case WM_HOTKEY: if (HIWORD(lParam) == VK_TBACK) { HWND hCtrl = GetDlgItem(hWnd, IDC_Path); if (hCtrl != GetFocus()) { SetFocus(hCtrl); SetWindowText(hCtrl, NULL); } else { SHSendBackToFocusWindow(uMsg, wParam, lParam); } } break; case WM_INITMENUPOPUP: if (LOWORD(lParam) == IDCANCEL) { CeleMenu m; HKEY hKey; m = (HMENU) wParam; if (RegOpenKeyEx(HKEY_CLASSES_ROOT, STR_AppName, 0, KEY_ALL_ACCESS, &hKey) == S_OK) { RegCloseKey(hKey); m.Check(IDM_Assoc, TRUE); } else { m.Check(IDM_Assoc, FALSE); } } break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_Browse: CeleCtrl::BrowseFile(hWnd, _MakeIntRes(IDC_Path), IDS_Filter); break; case IDC_Path: if (HIWORD(wParam) == EN_CHANGE) { s_mb.EnableButton(IDOK, GetWindowTextLength(GetDlgItem(hWnd, IDC_Path))); } else if (HIWORD(wParam) == EN_SETFOCUS) { DWORD dwConversion, dwSentence; ImmGetConversionStatus(NULL, &dwConversion, &dwSentence); ImmSetConversionStatus(NULL, dwConversion & ~IME_CMODE_NATIVE, NULL); } break; case IDM_Clear: SetDlgItemText(g_hWnd, IDC_Log, NULL); break; case IDM_Assoc: if (TRUE) { CeleMenu m; m = s_mb.GetMenu(IDCANCEL); if (m.IsChecked(IDM_Assoc)) { ASOC(TEXT("!")); ASOC(TEXT("!.reg")); ASOC(TEXT("!.ccs")); ASOC(TEXT("!.provxml")); CeleCtrl::ShowCmdMsg(IDM_Assoc, hWnd, _MakeIntRes(IDS_UnAssoc)); } else { ASOC(TEXT(".ccs")); ASOC(TEXT(".reg")); ASOC(TEXT(".provxml")); CeleCtrl::ShowCmdMsg(IDM_Assoc, hWnd, _MakeIntRes(IDS_Assoc)); } } break; case IDM_Help: return CeleCtrl::DlgBox(hWnd, HELP); case IDM_About: CeleAbout::Show(hWnd); break; case IDOK: if (HIWORD(wParam) == 0) { GetDlgItemText(hWnd, IDC_Path, tzStr, MAX_PATH); Process(tzStr, g_ptzCurFile); break; } case IDCANCEL: case IDM_Exit: EndDialog(hWnd, S_OK); break; } break; } return FALSE; }
LRESULT HandleModeCommand(HWND hWnd, WPARAM wParam, LPARAM lParam) { HIMC hIMC = ImmGetContext(hWndCompStr); DWORD dwConv, dwSent; DWORD dwTemp; ImmGetConversionStatus(hIMC,&dwConv,&dwSent); switch(LOWORD(wParam)) { case IDM_NATIVEMODE: dwTemp = dwConv & ~IME_CMODE_LANGUAGE; switch (dwConv & IME_CMODE_LANGUAGE) { case IME_CMODE_ALPHANUMERIC: dwTemp |= IME_CMODE_NATIVE; break; case IME_CMODE_NATIVE: dwTemp |= (IME_CMODE_NATIVE | IME_CMODE_KATAKANA); break; case (IME_CMODE_NATIVE | IME_CMODE_KATAKANA): /* fall-through */ default: break; } dwConv = dwTemp; break; case IDM_FULLHALF: if (dwConv & IME_CMODE_FULLSHAPE) { dwConv &= ~IME_CMODE_FULLSHAPE; } else { dwConv |= IME_CMODE_FULLSHAPE; } break; case IDM_ROMAN: if (dwConv & IME_CMODE_ROMAN) { dwConv &= ~IME_CMODE_ROMAN; } else { dwConv |= IME_CMODE_ROMAN; } break; case IDM_CHARCODE: if (dwConv & IME_CMODE_CHARCODE) { dwConv &= ~IME_CMODE_CHARCODE; } else { dwConv |= IME_CMODE_CHARCODE; } break; case IDM_HANJA: if (dwConv & IME_CMODE_HANJACONVERT) { dwConv &= ~IME_CMODE_HANJACONVERT; } else { dwConv |= IME_CMODE_HANJACONVERT; } break; case IDM_SOFTKBD: if (dwConv & IME_CMODE_SOFTKBD) { dwConv &= ~IME_CMODE_SOFTKBD; } else { dwConv |= IME_CMODE_SOFTKBD; } break; case IDM_EUDC: if (dwConv & IME_CMODE_EUDC) { dwConv &= ~IME_CMODE_EUDC; } else { dwConv |= IME_CMODE_EUDC; } break; case IDM_SYMBOL: if (dwConv & IME_CMODE_SYMBOL) { dwConv &= ~IME_CMODE_SYMBOL; } else { dwConv |= IME_CMODE_SYMBOL; } break; } ImmSetConversionStatus(hIMC,dwConv,dwSent); ImmReleaseContext(hWndCompStr,hIMC); return 1L; }