Catch key press when using unEnglish inputmethod in MFC - mfc

Recently, I am doing some research on i18n. I found that some non-English input method is different with English method in keyboard event. I tried to catch key press by overriding PreTranslateMessage method. But it doesn't work for Chinese and Russia input method. These method don't call PreTranslateMessage method. Does anyone know some solution for this?

Related

QInputDialog - confirm with enter-key

Im trying to use QInputDialog without buttons. It looks just like I want, but I connot confirm input (using it for text input). Is there a possibility to confirm with the enter key, so that exec() returns QInputDialog::Accepted ? Just like escape key makes the dialog return QInputDialog::Rejected ?
You could installEventFilter() on the QInputDialog, then have the eventFilter() accept() the dialog on a keypressevent(). :)

Subclassing EDIT control

I'm subclassing an edit control, and I'm looking for a message I could intercept that would allow me to capitalize the first letter in the box.
WM_KEYDOWN and WM_CHAR don't seem to have anything that identifies the characters case.
I currently have this working semi-good by processing the EN_UPDATE message in the parent window, but since I'm already subclassing the edit control, I'd prefer to do it in the subclassed proc.
Any help is appreciated and thanks in advance.
No, WM_CHAR definitely gives you case. WM_KEYDOWN doesn't. It doesn't solve your problem however, you also need to deal with WM_PASTE. Using EN_UPDATE is fine, it is sent in both cases, just watch out for recursion. And the pita of the parent getting it, the kind of problem that any class library solves.

C++ MFC Message handling

So I'm making an MFC application that handles a couple of different messages and will display different output based on which message was handled. So right now I have one that handles the WM_KEYDOWN message and displays that message's output. Now I also have one that handles WM_RBUTTONDOWN and what I want it to do is to start up the game of Brick Breaker that I am making. The issue that I'm having is that once I enter the WM_RBUTTONDOWN I want to disable certain keys so that I can control the paddle without calling the WM_KEYDOWN.
TL:DR How do you disable certain keys from the WM_KEYDOWNin MFC.
You can override PreTranslateMessage to see and bypass a message before MFC does its message map translation.
You shouldn't have to disable keys in your application. When another program has the focus, all input should go to that program.
You will want to forward the keys you are interested in to the code that drives your object.
You don't need to disable keys. It is simply up to your code to decide to process or not a key according to the state of the application.

C++ -- Win32 API, GUI stuff

I've been messing with Win32 API for abit, and I've got a question regarding the GUI functions.
How does one handle user input that is not managed through popup windows? I've been reading http://www.winprog.org/ but right when the interesting features comes -- lesson9 -- it becomes more abstract and I'm not sure how to do it.
Basically what I am after is the user to write input in two windows and then press a button to send a message that the content of the input is to be processed.
I think the input windows would be some EDIT-class windows and the input BUTTON-class but that's about it.
Any ideas? I'm sure it's simple, it's just makes me want to rip my hair of in native code :p
Cheers
You're correct, you want and EDIT control which is more commonly known as a TextBox and a BUTTON class which is a command button.
To get the the input the Button will send a WM_COMMAND message to its parent window with a BN_CLICKED in the wParam high word. You can identify the particular button from the hWnd you get in that message.
After that you'll need to post a WM_GETTEXT to the edit control to retrieve the users input.
This is all from memory so I highly recommend looking up the msdn pages before you code.
I'm not sure I follow 100%. Yes, you would use EDIT and BUTTON-class controls for that. Where are you getting stuck?

MFC ActiveX keystrokes

I have created an mfc activex control and want to handle the keystrokes. To handle keystrokes in child dialog. I override the pretranslate message in my child dialog class. To use pretranslate function in an activex control I have added hook.
As solution for the similar problem described at http://support.microsoft.com/kb/194294.
Now pretranslate function is calling but the problem when I press the ESC key or enter key, an assertion come at ASSERT(::IsWindow(m_hWnd));at wincore.cpp line 880.
I guess you use a function in PreTranslateMessage that assumes that the window is created. Put
if (!::IsWindow(m_hWnd)) { return 0; }
in the beginning of your PreTranslateMessage and see if that helps.