How to switch the number of Chinese and English input methods in Pb

Source: Internet
Author: User

 

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.

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.