Advertisement
MnInShdw

IME ON/OFF API

Jan 30th, 2019
1,162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Public Declare Function ImmGetContext Lib "imm32.dll" (ByVal hwnd As Long) As Long
  2. Public Declare Function ImmReleaseContext Lib "imm32.dll" (ByVal hwnd As Long, _
  3. ByVal himc As Long) As Long
  4. Public Declare Function ImmSetOpenStatus Lib "imm32.dll" (ByVal himc As Long, _
  5. ByVal b As Long) As Long
  6.  
  7.  
  8. Sub IMEControl2()
  9.  Dim hImc As Long
  10.  Dim myHWnd As Long
  11.  Dim Ret As String
  12.   'Check Version
  13.   If Application.Version > 9 Then
  14.   myHWnd = Application.hWnd
  15.   Else
  16.   myHWnd = FindWindow("XLMAIN", 0)
  17.   End If
  18.   hImc = ImmGetContext(myHWnd)
  19.   'IME OFF
  20.   If hImc <> 0 Then
  21.   Call ImmSetOpenStatus(hImc, 0)
  22.   Call ImmReleaseContext(myHWnd, hImc)
  23.   End If
  24.   Ret = Application.InputBox("Type.", Type:=2)
  25.   If Ret <> "" Then
  26.     MsgBox "IME-OFF with API :" & Ret
  27.   End If
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement