Click to See Complete Forum and Search --> : WM_TIMER Not coming to the Window
April 20th, 1999, 08:24 AM
I have set a Timer for 100 ms using SetTimer fn. It returns non zero value but WM_TIMER message is not coming to the window.
It's not coming to the OnTimer at all. I have also used spy to view WM_TIMER message. Spy also didn't get any WM_TIMER message for that wnd.
If anybody have any clue, pl help. Thanks in advance.
Masaaki
April 20th, 1999, 09:38 AM
Hi.
Check the following.
1) Where did you put SetTimer func?
-> OnCreate or OnInitDialog is better.
2) Did you add WM_TIMER message to your message handler?
HTH.
-Masaaki Onishi-
April 20th, 1999, 10:47 PM
I have put it in OnCreate only. Any other idea, pl Help.
----Mythili
Masaaki
April 21st, 1999, 01:06 AM
Hi.
afx_msg void OnTimer(UINT nTimerID);
///////////////////////////////////////
BEGIN_MESSAGE_MAP(CMainWindow, CFrameWindow)
ON_WM_CREATE()
ON_WM_TIMER()
END_MESSAGE_MAP()
int CMainWindow::OnCreate(LPCREATESTRUCT lpcs)
{
.....................
if(!SetTimer(ID_TIMER, 100, NULL)) {
MessageBox("Error: SetTimer failed");
return -1;
}
return 0;
}
void CMainWindow::OnTimer(UINT nTimerID)
{
your job
}
I assume that you don't use callback function.
Define ID_TIMER 200(whatever) at resource.h
Or directly use some number at SetTimer.
HTH.
-Masaaki Onishi-
JohnCz
October 13th, 1999, 02:54 PM
What window, what type of the application? Could you be more specific?
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.