Proper way to process messages to modeless dialogs
-
I have run into a situation that has me a bit confused. I have a dialog in my app which has a tab control in it, and each different tab has a modeless dialog in it. I am trying to get keyboard functionality for the modeless dialogs (eg. using TAB to switch between button controls) but with no success. I have declared a global HWND hDlgModeless and put it into my main message loop like so:
while (GetMessage (&msg, NULL, 0, 0)) { if ( hDlgModeless == NULL || !IsDialogMessage(hDlgModeless, &msg) ) { if ( !TranslateAccelerator(hwnd, hAccel, &msg) ) { TranslateMessage(&msg) ; DispatchMessage(&msg) ; } } } return msg.wParam;
I create each modeless dialog from within the WM_INITDIALOG of the modal dialog (which has the tab control) setting the parent window to be the modal dialog and a common dialog procedure for all the modeless dialogs. When I process TCN_SELCHANGE I just set hDlgModeless to equal the current modeless dialog the user has selected from the tab. Everything works great except for keyboard functionality. Is my approach in dealing with messages or in general, the setup completely wrong?