i cant get a timer to function properly

if i say this

invoke SetTimer,hWnd,idtimer,400,NULL

i get 0 returned in eax ; in other words the function failed

if i use

invoke SetTimer,NULL,idtimer,400,NULL
0 is not returned but...
i get no WM_TIMER message sent to the que
if anyone has run into this problem please explain

do i have to search the que for the message
idtimer should be returned in wParam
Posted on 2001-08-25 23:24:18 by titan
Hmmm. You'd better check the simple stuff like if hWnd contains the correct handle (it's not hWin by any chance?). If not, I found this in MSDN:

The WM_TIMER message is a low-priority message. The GetMessage and PeekMessage functions retrieve this message only when no other higher-priority messages are in the thread's message queue.

But I don't see why your window would receive any more msg's then any other window.

And this piece of text explains why the function succeeded if hWnd is NULL:

Handle to the window to be associated with the timer. This window must be owned by the calling thread. If this parameter is NULL, no window is associated with the timer and the nIDEvent parameter is ignored.
Specifies a nonzero timer identifier. If the hWnd parameter is NULL, this parameter is ignored.

If you're still stuck after double checking your code, try Iczillions tute on common controls, it contains a timer to make a progressbar move.
Posted on 2001-08-26 01:42:16 by Qweerdy

Heres a quick Prostart example.

I set a Timer in Main when you launch the prog.

Click on the File menu then click Test to set the second.

In each case a message box indicates success or not.

Both SetTimers set on my two machines.:)

Get example here.
Posted on 2001-08-26 04:28:50 by bcraven