3 out of 11 rated this helpful - Rate this topic

TimerProc callback function

Applies to: desktop apps only

An application-defined callback function that processes WM_TIMER messages. The TIMERPROC type defines a pointer to this callback function. TimerProc is a placeholder for the application-defined function name.

Syntax

VOID CALLBACK TimerProc(
  __in  HWND hwnd,
  __in  UINT uMsg,
  __in  UINT_PTR idEvent,
  __in  DWORD dwTime
);

Parameters

hwnd [in]

Type: HWND

A handle to the window associated with the timer.

uMsg [in]

Type: UINT

The WM_TIMER message.

idEvent [in]

Type: UINT_PTR

The timer's identifier.

dwTime [in]

Type: DWORD

The number of milliseconds that have elapsed since the system was started. This is the value returned by the GetTickCount function.

Return value

This function does not return a value.

Requirements

Minimum supported client

Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Header

Winuser.h (include Windows.h)

See also

Reference
KillTimer
SetTimer
WM_TIMER
Conceptual
Timers

 

 

Send comments about this topic to Microsoft

Build date: 2/3/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
4 years later usign visual studio 2005
What we should do when an access violation occurred in a TimerProc callback ?
The behaviour that access violation is eaten needs to be documented

It is not unreasonable for Windows to handle exceptions within a callback in this way.
Developers who want to handle exceptions need install their own handlers inside the callback.
But a note is helpful.

Exceptions in TimerProc
It appears that the TimerProc callback is enclosed in some sort of exception handler. If you deliberately write to NULL pointer in a TimerProc callback in straight C, the code silently fails. There's no crash and the code doesn't continue. Running under a debugger you can see exception 0xC0000005 occurring. Obviously some code in the bowels of win32 is wrapping this in an exception handler. This is VERY VERY VERY bad. It should at least be documented.