|
From: Ramana K. <ra...@my...> - 2002-08-10 11:13:55
|
Hi, I have a problem concerning timers in windows.
I am using only win32 API, and i use the fuction:
SetTimer(hwnd,id,len*100,NULL);
//hwnd is the HWND of the window, id is a UINT, len is a UINT
to set a timer that will later send a WM_TIMER message to my WindowProc. In
my WindowProc i have code like this:
case WM_TIMER:
{
myclass->blah();
return 0;
}
//myclass is a pointer to an object with a function called blah
and the function blah sets bool thebool to the value false.
in the function that calls SetTimer, i later have the code:
thebool = true;
while(thebool)
{
MessageBox(hwnd,"WAITING","ERROR",MB_OK); //this gets deleted
}
when i run the program, the messagebox comes up a number of times until
len*100 milliseconds has passed, then it resumes normal operation.
The problem is, i do not want to have to put up this messagebox. So i delete
the code for it. Once i do this, it seems the WM_TIMER message is never sent
for some reason. even if a put a messagebox in the case WM_TIMER: section,
it is never shown, unless i keep the messagbox in the while loop.
what is the meaning of this?
how am i using the timer wrongly?
thanks in advance
ramana
ps i also tried putting WaitMessage(); in the while loop instead, but it has
no effect.
|