Timer et Sleep

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hi,

Could you tell me why when i do this :

int WINAPI WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{

SetTimer(NULL, NULL, 500, TimerProc);

Sleep(4000);

return 0;
}

void CALLBACK TimerProc(HWND hwnd, UINT uMsg, UINT idEvent, DWORD
dwTime)
{
char msg[100];

sprintf(msg, "-- Tick Tack --");
Trace(msg); //write in a text file
}

void Trace(char *message)
{
FILE *trace;
trace=fopen("TimerEvolue.txt","a");

if(trace!=NULL)
{
fprintf(trace,"\t%s\n",message);
fprintf(trace,"/************************************************************************************************************/\n");

}

fclose(trace);
}

I've no trace of my timer in the Text file?

Thanks.

.



Relevant Pages

  • Re: Timer et Sleep
    ... if it's ever getting into the TimerProc? ... int WINAPI WinMain(HINSTANCE hInstance, ... void CALLBACK TimerProc(HWND hwnd, UINT uMsg, UINT idEvent, DWORD ... I've no trace of my timer in the Text file? ...
    (microsoft.public.windowsce.embedded.vc)
  • Re: Timerproc exception
    ... void CALLBACK timerproc ... Trying to trace a random deadlock bug I found that on occasion the callback ... would cause an exception in the C library function fgets (called with a NULL ...
    (microsoft.public.vc.mfc)
  • Re: Timerproc exception
    ... void CALLBACK timerproc ... Trying to trace a random deadlock bug I found that on occasion the callback ... would cause an exception in the C library function fgets (called with a NULL ...
    (microsoft.public.vc.mfc)
  • Re: Workerthread mit Timerfunktion
    ... Der Workerthread soll von meinem Hauptthread aus gestartet und ... VOID CALLBACK CMyThread::TimerProc(HWND hwnd, UINT uMsg, DWORD dwTime) ...
    (microsoft.public.de.vc)