
Problem with TAB control and a MODELESS dialog in a ATL COM DLL
I have a ATL COM DLL in which one of the interface methods invokes a
MODELESS dialog. If from a Front End application if I call the interface
method, the MODELESS dialog pops up. Here I had a problem initially. The
problem was: After invoking the MODELESS dialog from the Front End, on
TAB key press, Focus was not shifting from one control to the other. I
solved the problem by writing the following code in the
PreTranslateMessage of the Front End:
HWND hWndModeless = GetActiveWindow();
if (hWndModeless != NULL)
{
if (IsDialogMessage(hWndModeless, pMsg))
return TRUE;
}
return CWinApp::PreTranslateMessage(pMsg);
After this, on TAB key press, Focus started shifting from one control to
the other. BUT even if the focus is on a EDIT BOX, on TAB key press, the
focus shifts to the next control - WHICH IS NOT DESIRABLE. i.e., If the
focus is on a EDIT BOX, on TAB key press, the focus SHOULD NOT shift to
the next control.
So, I tried to trap the TAB key press of the edit control, by
subclassing CEdit and overrided OnChar(). But when TAB key is pressed
OnChar() is not at all getting executed. So I failed in trapping it.
Can anybody please help me?
Regards,
Balaji