프로그래밍 강의/C++

IME 한/영 상태 전환하기

wnsrn3436 2013. 2. 6. 13:20

아래의 두 가지 방법이 있습니다.

엮인 글: IME 한/영 상태 얻기

 

void set_language(double mode)
{
    if(hIMC=ImmGetContext(hWnd))
    {
        ImmNotifyIME(hIMC, NI_COMPOSITIONSTR, CPS_CANCEL, 0);
        
        DWORD dwConv, dwSent, dwTemp;
        BOOL bRet=ImmGetConversionStatus(hIMC, &dwConv, &dwSent);
        if(bRet)
        {
            dwTemp=dwConv & ~IME_CMODE_LANGUAGE;
            if(mode==0){dwTemp |= IME_CMODE_ALPHANUMERIC;}
            else{dwTemp |= IME_CMODE_NATIVE;}
            dwConv=dwTemp;
            ImmSetConversionStatus(hIMC, dwConv, dwSent);
        }
        ImmReleaseContext(hWnd, hIMC);
    }
}

 

void ime_set_language(double mode)
{
    if(hIMC=ImmGetContext(hWnd))
    {
        ImmNotifyIME(hIMC, NI_COMPOSITIONSTR, CPS_CANCEL, 0);
        
        DWORD dwConv, dwSent;
        BOOL bRet=ImmGetConversionStatus(hIMC, &dwConv, &dwSent);
        if(bRet)
        {
            ImmSetConversionStatus(hIMC, mode, dwSent);
        }
        ImmReleaseContext(hWnd, hIMC);
    }
}
Comments