I'm writing an application that draws a non-model dialog box which contains various controls to show percentage of progress complete, processing output, etc.
The call to create the dialog is nice and simple:
void MyClass::StartProgressBar()
{
m_pProgressHWND = CreateDialog ( hInstance, MAKEINTRESOURCE ( IDD_PROGRESS ), m_pInterface->GetHWnd(), ProgressDlgProc );
ShowWindow ( m_pProgressHWND, SW_SHOWNORMAL );
}
Nothing too strenuous and all is good.
The ProgressDlgProc callback is all set-up and captures WM_INITDIALOG and a few other messages and executes fine.
Now, the problem is I havea few helper functions to update various controls (text, progress bars) and they work fine and update the controls when called.
However, the problem is that the actually dialog doesn't actually finish it's main drawing until *after* the whole process is complete. Whats happening is the dialog frame is appearing, the controls that I update get updated but general stuff like group frames aren't drawn until the whole shebang is finished.
I did find this article via Google that does something similar but it's only to pause opening another dialog, not to pause the main process:
In simple terms what I want is something like:
StartProgressBar();
// do something here to wait until the dialog is fully drawn
DoProcess();
I've tried setting flags in the callback and looping in place until their state changes but of course, that locks my program into an endless loop.
Any insights?
- Jed
The call to create the dialog is nice and simple:
void MyClass::StartProgressBar()
{
m_pProgressHWND = CreateDialog ( hInstance, MAKEINTRESOURCE ( IDD_PROGRESS ), m_pInterface->GetHWnd(), ProgressDlgProc );
ShowWindow ( m_pProgressHWND, SW_SHOWNORMAL );
}
Nothing too strenuous and all is good.
The ProgressDlgProc callback is all set-up and captures WM_INITDIALOG and a few other messages and executes fine.
Now, the problem is I havea few helper functions to update various controls (text, progress bars) and they work fine and update the controls when called.
However, the problem is that the actually dialog doesn't actually finish it's main drawing until *after* the whole process is complete. Whats happening is the dialog frame is appearing, the controls that I update get updated but general stuff like group frames aren't drawn until the whole shebang is finished.
I did find this article via Google that does something similar but it's only to pause opening another dialog, not to pause the main process:
In simple terms what I want is something like:
StartProgressBar();
// do something here to wait until the dialog is fully drawn
DoProcess();
I've tried setting flags in the callback and looping in place until their state changes but of course, that locks my program into an endless loop.
Any insights?
- Jed