Function declaration:
Function Boolean immsimulatehotkey (ulong hwnd, ulong dwhotkeyid) Library "imm32.dll"
Function ulong getkeyboardlayout (ulong dwlayout) Library "user32.dll"
Function Boolean immisime (ulong hklkeyboardlayout) Library "imm32.dll"
The script is as follows:
Constant int ime_thotkey_ime_nonime_toggle = 112
Ulong hklcurrent
Ulong HND
// Switch to the English Input Method
Hklcurrent = getkeyboardlayout (0)
If immisime (hklcurrent) then
HND = handle (parent)
Immsimulatehotkey (HND, ime_thotkey_ime_nonime_toggle)
End if
// Switch to the Chinese Input Method
Hklcurrent = getkeyboardlayout (0)
If not immisime (hklcurrent) then
HND = handle (parent)
Immsimulatehotkey (HND, ime_thotkey_ime_nonime_toggle)
End if
Int li_rownumber
String ls_rownumber
Constant int ime_thotkey_ime_nonime_toggle = 112
Ulong hklcurrent
Ulong HND
Li_rownumber = ldw_data1_1_getcolumn ()
Ls_rownumber = string (li_rownumber)
Ls_rownumber = "," + ls_rownumber + ","
If match (ls_item_list, ls_rownumber) then
// Switch to the Chinese Input Method
Hklcurrent = getkeyboardlayout (0)
If not immisime (hklcurrent) then
HND = handle (lw_window)
Immsimulatehotkey (HND, ime_thotkey_ime_nonime_toggle)
End if
Else
// Switch to the English Input Method
Hklcurrent = getkeyboardlayout (0)
If immisime (hklcurrent) then
HND = handle (lw_window)
Immsimulatehotkey (HND, ime_thotkey_ime_nonime_toggle)
End if
End if
1 first define the following APIs in the local extenal Function
Function function Boolean immsimulatehotkey (unsignedlong hwnd, unsignedlong dwhotkeyid) Library imm32.dll
Function unsignedlong getkeyboardlayout (unsignedlong wlayout) Library user32.dll
Function Boolean immisime (unsignedlong hklkeyboardlayout) Library imm32.dll
If datawindow is used
Ulong hklkeyboardlayout
Choose case dwo. Name
Case chinese_text field that requires Chinese Input
Hklkeyboardlayout = getkeyboardlayout (0)
If not immisime (hklkeyboardlayout) Then immsimulatehotkey (handle (part, 112)
End if
Case englist_text: English input field
Hklkeyboardlayout = getkeyboardlayout (0)
If immisime (hklkeyboardlayout) Then immsimulatehotkey (handle (parent), 112)
End if
End choose
It is similar in the Windows edit box.