Bonjour j'ai une edit box dans laquelle l'utilisateur entre une heure (heures, minutes et secondes)!
J'ai d�j� post� un message semblable il y a quelques jours, je remercie farscape pour sa collaboration.

A pr�sent j'ai rajout� une partie de code qui est cens�e v�rifier le format des secondes:
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
void CWorkshiftDialog::OnChangeHour0() 
{
	CString str; 
	GetDlgItem(IDC_HOUR0)->GetWindowText(str); 
	str.TrimRight(); 
 
	char *stopstring=NULL; 
	long l = strtol( str, &stopstring, 10 ); 
	if(l>23) 
	{ 
		AfxMessageBox("Msg1 Invalid hour format! Must be between 0 and 23!"); 
		str="";
		UpdateData(FALSE);
		return; 
	} 
	if(stopstring && *stopstring && *stopstring!=':') 
	{ 
		AfxMessageBox("Msg2 Invalid separator character! Must be ':' !"); 
		str="";
		UpdateData(FALSE);
		return; 
	} 
	if(str.GetLength()>3) 
	{ 
		stopstring=NULL; 
		l = strtol( str.Mid(3,2), &stopstring, 10 ); 
		if(l>59) 
		{ 
		  AfxMessageBox("Msg3 Invalid minute format! Must be between 0 and 59!"); 
		  str="";
		  UpdateData(FALSE);
		  return; 
		}
	}
	if(stopstring && *stopstring && *stopstring!=':') 
	{ 
		AfxMessageBox("Msg4 Invalid separator character! Must be ':' !"); 
		str="";
		UpdateData(FALSE);
		return; 
	} 
	if(str.GetLength()>5) 
	{ 
		stopstring=NULL; 
		l = strtol( str.Mid(5,2), &stopstring, 10 ); 
		if(l>59) 
		{ 
		  AfxMessageBox("Msg5 Invalid second format! Must be between 0 and 59!"); 
		  str="";
		  UpdateData(FALSE);
		  return; 
		} 
	} 
	if(str.GetLength()>8) 
	{ 
	   AfxMessageBox("Msg6 Invalid time format!"); 
	   return; 
	} 
}
Le probl�me est le suivant: lorsque je tape le premier chiffre des minutes, le message 4 s'affiche directement!

Faut-il donner un nom diff�rent au deux s�parateurs ':' ??
Ou alors dois-je cr�er une autre fonction qui v�rifiera combien de caract�res j'ai entr� avant de tester mon deuxi�me s�parateur?