Bonjour.
j'ai cliqu� nouveau projet-> mfc appwizad exe ->multiple documents.
Je voudrais cree des richedits dans mes fenetres child et pouvoir sauvgarder toutes les fenetres.
Mais je sais pas comment faire.
Merci.
Bonjour.
j'ai cliqu� nouveau projet-> mfc appwizad exe ->multiple documents.
Je voudrais cree des richedits dans mes fenetres child et pouvoir sauvgarder toutes les fenetres.
Mais je sais pas comment faire.
Merci.
Ben d'abord qu'elle type de sauvegarde tu veu faire BDD ou fichier TXT
Apres pour tes traitements
Tu fai un clik droit sur ton dialogue tu va dan le classwizard tu lui affecte une variable ensuite tu bosse dessus.
![]()
salut,
en ce qui concerne la sauvegarde des donn�es contenues dans tes controles, tu peux commencer par regarder cette faq et te rensigner plus g�n�ralement sur la s�rialisation (serialize).
Hope it helps.
sulement du fichiers txt.
Je voudrais juste ajouter une richetext dans les fenetres child et sauvegarder le tout dans des fichiers.
tu peux me donner un exemple stp.
Il faut declarer un CRichEditCtrl je crois.
Merci de m'aider.
tien voila le code te permetant d'ouvrir une boite de dialogue afin de recuperer ton fichier txt.
ici c csv :
Ensuite voila le code te permetant de lire dans le fichier et dextraire les caract�res :
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 void CChronoGram::OnButtonChargeResultat() { CFileDialog m_ldFile(TRUE) ; CFileException fException; CString strExt ; char filtre[]={"Fichiers résultat (*.csv)\0*.csv\0(*.*)\0*.*\0\0"} ; // m_ldFile.m_ofn.lpstrInitialDir=folder ; m_ldFile.m_ofn.lpstrFilter=filtre ; m_ldFile.m_ofn.nFilterIndex = 1 ; m_ldFile.m_ofn.lpstrDefExt="*.csv" ; m_ldFile.m_ofn.Flags |= OFN_CREATEPROMPT ; m_ldFile.m_ofn.lpstrTitle="Ouvre un fichiers temps" ; if ( m_ldFile.DoModal() == IDOK ) { strCSVNameResultat = m_ldFile.GetPathName() ; AnalyseFichierCSV() ; } else strCSVNameResultat = "" ; m_strNomResultat = strCSVNameResultat ; UpdateData(FALSE) ; }
et ce code permet d'affecter le contenu du fichier txt dan un tableau.
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 char *CChronoGram::ExtraitValeurTemps(int index , char *p, int *pVal) { char tVal[32] ; int i=0 ; while ( (*p) && (*p!=',') && (*p!=9) && (i<32) ) { if (*p!=' ') tVal[i++] = *p++ ; else p++ ; } tVal[i] = 0 ; *pVal = 0 ; if ( sscanf(tVal, "%d", pVal ) == 1) { tabValTemps[index] = *pVal ; if (*p==',') return (++p) ; else return (NULL) ; } else return (NULL) ; }
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
74
75
76
77
78
79
80
81
82
83
84 void CChronoGram::AnalyseFichierCSV() { FILE *f ; char *p, tLigne[128] ; int index ; int iVal ; if (strCSVNameResultat!="") { f = fopen(LPCSTR(strCSVNameResultat),"r") ; if (f) { p = fgets(tLigne,sizeof(tLigne),f) ; if(p) { index = 0 ; while( index<NB_PROCESS ) { p = ExtraitValeurTemps ( index++, p , &iVal) ; } // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 // T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 T11 T12 T12 T13 // 15,43 ,21 ,604,32 ,66, 22,45, 32, 21, 43, 34, -1,78 tabValGroupe[0] = tabValTemps[0] + tabValTemps[1] ; tabValGroupe[1] = tabValTemps[2] ; tabValGroupe[2] = tabValTemps[3] + tabValTemps[4] ; tabValGroupe[3] = tabValTemps[5] + tabValTemps[6] ; if (tabValTemps[11]<0) { m_strT12_1 = "N/A" ; } else { tabValGroupe[4] = tabValTemps[11] ; m_strT12_1.Format("%1.3f",(float)tabValTemps[11]/1000) ; } if (tabValTemps[12]<0) { m_strT12_2 = "N/A" ; } else { tabValGroupe[4] = tabValTemps[12] ; m_strT12_2.Format("%1.3f",(float)tabValTemps[12]/1000) ; } tabValGroupe[5] = tabValTemps[8] + tabValTemps[9] + tabValTemps[10] + tabValGroupe[4] + tabValTemps[13] ; CString conversion; conversion.Format("%i",tabValTemps[0]); AfxMessageBox(conversion); m_strT1.Format("%1.3f",(float)tabValTemps[0]/1000) ; m_strT2.Format("%1.3f",(float)tabValTemps[1]/1000) ; m_strTG1.Format("%1.3f",(float)tabValGroupe[0]/1000) ; m_strT3.Format("%1.3f",(float)tabValTemps[2]/1000) ; m_strTG2.Format("%1.3f",(float)tabValGroupe[1]/1000) ; m_strT4.Format("%1.3f",(float)tabValTemps[3]/1000) ; m_strT5.Format("%1.3f",(float)tabValTemps[4]/1000) ; m_strTG3.Format("%1.3f",(float)tabValGroupe[2]/1000) ; m_strT7.Format("%1.3f",(float)tabValTemps[6]/1000) ; m_strT8.Format("%1.3f",(float)tabValTemps[7]/1000) ; m_strTG4.Format("%1.3f",(float)tabValGroupe[3]/1000) ; m_strT9.Format("%1.3f",(float)tabValTemps[8]/1000) ; m_strT10.Format("%1.3f",(float)tabValTemps[9]/1000) ; m_strT11.Format("%1.3f",(float)tabValTemps[10]/1000) ; m_strT13.Format("%1.3f",(float)tabValTemps[13]/1000) ; m_strTG5.Format("%1.3f",(float)tabValGroupe[4]/1000) ; m_strTG6.Format("%1.3f",(float)tabValGroupe[5]/1000) ; } fclose(f) ; } } }
Afin de mieu comprendre ce code voila ce qu'il fait :
J'ouvre un fichier .csv contenant des chiffres separ� par des virgules.
Apres chaque virgule je recupere la valeur et je l'envoi dan un tableau.
Voila j'espere que ca ira mieux![]()
ok merci.
Mais pour commencer ,comment creer les richextbox et les inserer dans les fenetres child stp?
la FAQ dispose d'une fonction de recherche aussi
J'ai pas trouv�
Salut.
C'est un richedit pour un cdialog.
Je cherche pour une fenetre child.
Excuse moi je debut en programmation.
soit tu veux une RichEditView auquel cas il faut le pr�ciser lorsque tu construis le projet,
soit tu veux placer un contr�le dans une dialog (child ou non) auquel cas![]()
Peux tu m'indiquer la marche a suivre pour ajouter une richediview lorsque je construit le projet?
Merci.
Partager