Create your own keyboard in C++ MFC app

2019-09-13 17:26发布

I am trying to understand how I can have a button click event pass a specific string as an input to any currently selected edit text. In other words, I want to mimic a key press in a keyboard to pass the character of that key to input.

For example, say we have a MFC Button Control tool with ID mfcButton and two Edit Control tools with IDs editA and editB, respectively. In the OnBnClickedBtnAdd event handler I can add editT.SetWindowTextW(_T("a")); where editA is the control variable for that edit control.

I am interested to not make the event handler of the mfcButton be for a specific edit control but instead send that "a" text as an input to any selected edit control.

Could not find anything similar case online or on the documentation. Any example code or link will be very useful.

Effectively, I am trying to create my own keyboard on my MFC app screen so that every key press will pass its character only to the currently selected edit text control of my screen.

0条回答
登录 后发表回答