I'm writing an application that communicates and initializes instruments (via COM ports) during the initialization phase of a Dialog (using MFC, on Windows 10).
The instrument initialization is presently taking between 4 seconds and 10 seconds. So the GUI won't appear until the initialization is finished.
I want to know how to perform the drawing of the GUI, then call the instrument initialization function.
Here's a code fragment:
BOOL MyDialog::OnInitDialog()
{
//...
// code to initialize dialog widgets
//...
Initialize_Intruments();
return false;
}
From the Microsoft Documentation of the CDialog::OnInitDialog method:
Remarks
Windows sends the WM_INITDIALOG message to the dialog box during the Create, CreateIndirect, or DoModal calls, which occur immediately before the dialog box is displayed. {emphasis mine}
I want to perform functionality, after the dialog box is displayed, during initialization of the dialog.
How to do this using C++, MFC, Visual Studio (2017) and Windows 10?
Notes:
- The application is a single dialog that runs test procedures.
- A splash screen is another technique under consideration.