Home > Software engineering >  MFC soft keyboard use Microsoft pinyin can't play it
MFC soft keyboard use Microsoft pinyin can't play it

Time:09-15

The same code, in the latest win10 cannot use Microsoft pinyin input straight

Win10 version 1607, Build: 14393 (you can even play)


Win10 version 1903, Build: 18362 (can't even play)


Click on the letter key code: type a, the parameter is 65
 

InputSoftKey (65);

Void InputSoftKey (WORD wVk)
{
CEdit * pBtn=(CEdit *) GetDlgItem (IDC_EDIT1);
PBtn - & gt; SetFocus ();
Keybd_event (wVk, MapVirtualKey (0 x41, 0), 0, 0).
Keybd_event (wVk, MapVirtualKey (0 x41, 0), KEYEVENTF_KEYUP, 0).
}

Development tools VS2017 MFC

Associated with Microsoft pinyin?

Or similar within the program implementation project of soft keyboard input links refer to this to me, thank you,

CodePudding user response:

 
Void SimKey (char the chKey)
{
HKL HKL=GetKeyboardLayout (GetCurrentThreadId ());
BYTE bScan=(BYTE) MapVirtualKeyEx (the chKey MAPVK_VK_TO_VSC, hKL);
Keybd_event (the chKey bScan, 0, NULL);
Keybd_event (the chKey, bScan KEYEVENTF_KEYUP, NULL);
}

Void CDlg1Dlg: : OnBnClickedButton1 ()
{
//TODO: add the control notification handler code

GetDlgItem (IDC_EDIT1) - & gt; SetFocus ();
SimKey (" W ");
SimKey (' O ');
SimKey (' D ');
SimKey (' E ');
SimKey (' Z ');
SimKey (' U ');
SimKey (" G ");
SimKey (' U ');
SimKey (' O ');

}



  • Related