Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Help me~ international users T_T (IME)


  • Please log in to reply
4 replies to this topic
netics
  • Members
  • 20 posts
  • Last active: Nov 23 2006 12:19 PM
  • Joined: 21 Jan 2006
i am a korean. so i have to use both input mode (korean and english)

what i want to know is current status of IME.

below is C code to do this

------------ C code ---------------------------
HIMC himc = ImmGetContext(GetSafeHwnd());
BOOL  m_bIsHan = ImmGetOpenStatus(himc);
ImmReleaseContext(GetSafeHwnd(), himc);
------------------------------------------------

i tried to port above to ahk code

------------ ahk code -----------------------------
IME_CheckMode(hwnd)
{
himc := DllCall("Imm32\ImmGetContext", "UInt", hwnd)
ret := DllCall("Imm32\ImmGetOpenStatus", "UInt", himc)
DllCall("Imm32\ImmReleaseContext", "UInt", hwnd, "UInt", himc)
return ret
}
-----------------------------------------------------


it always fails at first call. variable himc is always 0.

IME_CheckMode( WinExist("A") )

and

IME_CheckMode( GetChildHWND(WinExist("A"), "Edit1") )

also fail.


any idea?

PhiLho
  • Moderators
  • 6850 posts
  • Last active: Jan 02 2012 10:09 PM
  • Joined: 27 Dec 2005
I guess there isn't much Asian users of AutoHotkey around...

I checked the imm32.dll I have on my system, it does have the described function without appended A or W, so that's not the problem (that I met elsewhere).

Did you checked the ErrorLevel after each call? It can show some problems.

Beyond that, I don't see, the DllCalls can be hard to debug...
Posted Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")

netics
  • Members
  • 20 posts
  • Last active: Nov 23 2006 12:19 PM
  • Joined: 21 Jan 2006
thx for reply Philho. T_T

yes, i checked ErrorLevel. it was 0. success.

T_T.

why my ahk life is always bug-messed -_-?

Mr.Lee
  • Guests
  • Last active:
  • Joined: --

App  key:          ->English Mode

Right-win key:  -> Hangul Mode

 



IME_CHECK(WinTitle)

{

    WinGet,hWnd,ID,%WinTitle%

    Return Send_ImeControl(ImmGetDefaultIMEWnd(hWnd),0x005,"")

}



 



Send_ImeControl(DefaultIMEWnd, wParam, lParam)

{

    DetectSave := A_DetectHiddenWindows       

    DetectHiddenWindows,ON                            



     SendMessage 0x283, wParam,lParam,,ahk_id %DefaultIMEWnd%

    if (DetectSave <> A_DetectHiddenWindows)

        DetectHiddenWindows,%DetectSave%

    return ErrorLevel

}



 



ImmGetDefaultIMEWnd(hWnd)

{

    return DllCall("imm32\ImmGetDefaultIMEWnd", Uint,hWnd, Uint)

}





Rwin::

    ret := IME_CHECK("A")

    if %ret% = 0                 ; 0 :English

    {

        Send, {vk15sc138}   

    }

return



 



AppsKey::

    ret := IME_CHECK("A")

    if %ret% <> 0               ; 1 Hangul

    {

        Send, {vk15sc138}   

     }

return



netics
  • Members
  • 20 posts
  • Last active: Nov 23 2006 12:19 PM
  • Joined: 21 Jan 2006
Mr.Lee. Great!!!