OXMaskedEdit Seems To Be Disabled when another thread is running
Posted on 2006-03-28
I am using the MDI interface not for the purpose of actually interacting with documents, it is to allow multiple dialogs to be active on the screen at once. When the use makes a menu selection, I call OnOpenDocument and from there tell the view class which dialog do open modelessly. The view sizes itself to the dialog, and the user provides input which will sometimes cause a report to run. When the user requests a report, I use AfxBeginThread(&FunctionName, LPVOID *) to launch a Thread. This act of launching a thread somehow disables OXMaskedEdit so that no input may be made to a MaskedEdit field until the Thread Exits.
For instance, there might be two or more documents open, each of which is really just an empty document, but the view knows to Create a specific dialog based on the parameters when the document was opened. When the user clicks OK on one of the dialogs, the OK and Cancel buttons are disabled, the WM_CLOSE message is disabled, the cursor becomes IDC_WAIT(for the specific view only), and a thread is launched using the non-interactive version of AfxBeginThread().
EVERYTHING else seems to work as I would expect (all other dialogs, reports, fields, etc. work a little more slowly, but otherwise correctly), but any field that is COXMaskedEdit simply acts as if there has been no keyboard input at all. If I click in one of the MaskedEdit fields, then the cursor moves there, but input is ignored. The keystrokes are not stored either. When the thread returns, the field works correctly, but doesn't rememer the items typed while the thread was running. This seems to occur whether the dialog that started the thread contained a COXMaskedEdit field or not.
I'm still completely in the dark, but I did do some further testing, and it would seem that the control is receiving the OnKeyDown message, but not the OnChar message.
Does anyone have any ideas?
Thanks in advance, Rick