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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
void CValeur_ConstantesDlg::OnRechercher() 
{
	// TODO: Add your control notification handler code here
	int Constante_No_Exist;
	long ind;
	CString temp_ici;

	Constante_No_Exist=0;
	ind=0;

	sprintf(fichier_copier, "%s\\test.xlt", Appli);
	fd_o = fopen(fichier_copier, "w+");
	fprintf(fd_o, "CONSTANTE\tVALEUR\tTYPE\tCOMMENTAIRE\tNUMERO_LIGNE \n");

	m_Constante.GetWindowText(temp_ici);
	sprintf(Constante,temp_ici);
	DBI_vire_blanc(Constante);
	DBI_vire_blanc_debut(Constante);
	DBI_conversion_majuscule(Constante);

	if(test==0)
		/* griser le bouton après ce test */
	if(test==1 && recherche==1)
	{
		for(ind=0; ind<gl_nb_elt_p_rech_const; ind++)
		{
			if(strcmp(Constante, gp_rech_const[ind].nom_constante) == 0)
			{
				m_Valeur.SetWindowText(gp_rech_const[ind].valeur);
				m_Type.SetWindowText(gp_rech_const[ind].type_constante);
				m_Commentaire.SetWindowText(gp_rech_const[ind].commentaire);
				Constante_No_Exist=1;
			}
		}
		if(Constante_No_Exist==0)
			{
				AfxMessageBox("LA CONSTANTE N'EXISTE PAS", MB_ICONINFORMATION);
				m_Valeur.SetWindowText("");
				m_Type.SetWindowText("");
				m_Commentaire.SetWindowText("");
			}
	}
	else if(test==1 && recherche==0)
	{
		m_Valeur.SetWindowText("");
		m_Type.SetWindowText("");
		m_Commentaire.SetWindowText("");

		for(ind=0; ind<gl_nb_elt_p_rech_const; ind++)
		{
			if(DBI_cherche_chaine(gp_rech_const[ind].nom_constante, Constante)!=FALSE)
			{
				fprintf(fd_o, "%s\t%s\t%s\t%s\t%ld \n", gp_rech_const[ind].nom_constante, gp_rech_const[ind].valeur, gp_rech_const[ind].type_constante, gp_rech_const[ind].commentaire, gp_rech_const[ind].num_ligne);	
			}
		}

		fclose(fd_o);
		HINSTANCE nerror;
		CString strApp=fichier_copier;
		nerror=ShellExecute(AfxGetMainWnd()->m_hWnd, NULL, strApp, NULL, NULL, SW_SHOWNORMAL);

		if(reinterpret_cast<int>(nerror) <= 32)
		{
			CString mess;
			mess.Format("Erreur de lancement de l’application:\n%s Erreur n°:%d", (const char *)strApp,nerror);
			AfxMessageBox(mess,MB_ICONEXCLAMATION);
		}
	}
	else
		AfxMessageBox("\t    ERREUR ! VERIFIER VOS PARAMETRES\n\t\t\tOU\nAPPUYER SUR CHARGER AVANT DE LANCER LA RECHERCHE",MB_ICONSTOP);

	
}
Voila mon code en bref je recherche une constante dans un fichier. Je voudrais griser mon bouton RECHERCHER, tant que test==0.
test==0 tant que le programme n'a pas fini de lire le fichier (fonction que j'ai crée dans une aiutre classe).
Merci
Merci de penser à la balise code...