views:

228

answers:

0

I'm writing a GUI driven by dialog boxes using Win32 and MSVC 6.0, and I'm struggling to understand the usage of WM_INITDIALOG.

It's my understanding that WM_INITDIALOG will be called by the dialog process prior to painting it to the screen. The issue I'm having is that WM_INITDIALOG is being called only when I am stepping through the program with the the debugger, and not when I take the breakpoints out of the code and just run the program.

To make the issue more confusing, dialog boxes earlier in the program do use WM_INITDIALOG and work fine. For instance, the call to start the initial dialog process would be:

DialogBox (ghInstance,
           MAKEINTRESOURCE(IDD_SETTINGS),
           hWnd,
           (DLGPROC) SettingsDialogProc);

Which calls WM_INITDIALOG as anticipated. Then a subsequent dialog box would be:

DialogBox (ghInstance,
           MAKEINTRESOURCE(IDD_SELECTION),
           hDlg,
           (DLGPROC) SelectionDialogProc);

which only moves through WM_INITDIALOG when stepped into with the debugger, and not when breakpoints are taken out of the code and just run. All of the other functionality of the dialog box works just fine however.

If anyone has any ideas, I would be very grateful. This is a very puzzling problem.