
Starting a Dialog Based app minimized.
The problem here is that a dialog isn't quite a window, and therefore
can't be altered through PreCreateWindow. No, that would be too easy. So
what you can do instead is handle this sort of style change in OnInitDialog.
The key here is to do it BEFORE calling the parent class' method.
Example:
BOOL CMinimizeDlg::OnInitDialog()
{
WINDOWPLACEMENT wp;
// Get the current placement to preserve size, etc.
GetWindowPlacement(&wp);
// Set how you'd like it to be shown.
wp.showCmd = SW_MINIMIZE;
SetWindowPlacement(&wp);
// Carry on as usual.
CDialog::OnInitDialog();
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
Quote:
}
Hope that helps.