Hi
I wonder if any kind soul could help me with a timer problem in c.
I am not at all experienced in writing c code.
In a c dll (called from a vb user control) I need to avoid blocking the parent application, and also be able to abort the dll function if the parent terminates. I want to use a timer for this purpose.
VOID CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD);
//dllFunction
int iTimerID;
iTimerID = SetTimer (NULL, 0, 200, (TIMERPROC)TimerProc);
//do some stuff (may take several seconds)
KillTimer(0,iTimerID);
return;
VOID CALLBACK TimerProc(
HWND hwnd,
UINT uMsg,
UINT_PTR idEvent,
DWORD dwTime
)
{
MSG Msg = { 0 };
while( PeekMessage( &Msg, NULL, 0, 0, PM_REMOVE ) == TRUE)
{
TranslateMessage( &Msg );
DispatchMessage( &Msg );
}
}
The timer is created and a handle returned. However I am obviously doing something wrong as the callback procedure never gets called.