Background
---------------
I have an SDI application.
from a menu selection the application does this:
CMyDialog dialog;
int response = dialog.DoModal();
the CMyDialog class overrides the OnInitDialog function to:
{
CDialog::OnInitDialog();
int result = this->SetTimer (1, 100, NULL);
}
The CMyDialog::OnTimer function receives the WM_TIMER messages and checks the elapsed time on each activation and "timesout" if appropriate, causing the dialog to close automatically with a call to KillTimer(1) and then OnCancel().
This means the user has a certain period of time to hit ok otherwise cancel is assumed.
Problem
----------
Now the problem is that the dialog does not show itself until KillTimer is called. If I call KillTimer at the end of OnInitDialog then the dialog shows. (but obviously then I have no Timer running).
I have the dialog template attribute "visible" set to false. If I set this to true the dialog shows itself immediately but the WM_TIMER messages from SetTimer are not received anywhere.
I have put OnTimer functions in the main application, the main window and in my class, but none of these are receiving them and so it makes me wonder if SetTimer is working.
How do I get both the WM_TIMER messages and the dialog visible ?
Thanks in advance for all suggestions.
---------------
I have an SDI application.
from a menu selection the application does this:
CMyDialog dialog;
int response = dialog.DoModal();
the CMyDialog class overrides the OnInitDialog function to:
{
CDialog::OnInitDialog();
int result = this->SetTimer (1, 100, NULL);
}
The CMyDialog::OnTimer function receives the WM_TIMER messages and checks the elapsed time on each activation and "timesout" if appropriate, causing the dialog to close automatically with a call to KillTimer(1) and then OnCancel().
This means the user has a certain period of time to hit ok otherwise cancel is assumed.
Problem
----------
Now the problem is that the dialog does not show itself until KillTimer is called. If I call KillTimer at the end of OnInitDialog then the dialog shows. (but obviously then I have no Timer running).
I have the dialog template attribute "visible" set to false. If I set this to true the dialog shows itself immediately but the WM_TIMER messages from SetTimer are not received anywhere.
I have put OnTimer functions in the main application, the main window and in my class, but none of these are receiving them and so it makes me wonder if SetTimer is working.
How do I get both the WM_TIMER messages and the dialog visible ?
Thanks in advance for all suggestions.