Bonjour,

J'ai une erreur avec la fonction settimer()
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// timer2.cpp : Defines the entry point for the console application.
//
 
#include "stdafx.h"
 
#include <windows.h>
 
int countact=0;
 
VOID CALLBACK TimerProc(          HWND hwnd,
    UINT uMsg,
    UINT_PTR idEvent,
    DWORD dwTime
)
{
	countact++;
	printf("%d \0x1",countact);
}
 
int _tmain(int argc, _TCHAR* argv[])
{
	SetTimer(NULL,NULL,1,TimerProc); //Précision au milli-seconde
	while (1)
	{
		MSG msg;
		while (GetMessage(&msg, NULL, 0, 0))
		{
			//if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
			{
				TranslateMessage(&msg);
				DispatchMessage(&msg);
			}
		}
	}
	return 0;
}
la fonction TimerProc n'est pas appelée tous les millisecondes.
Elle est appelé 100 fois par secondes uniquement au lieu de 1000

J'ai une question hors-sujet :
Comment faire une fois le texte affiché , revenir à la position 0 en X avec printf ?
Merci.