Bonsoir,

j'ai créé un projet en boite de dialogue. Il y a une boite de dialogue principale puis une seconde qui est ouverte lors du clique sur un bouton.

J'ai un souci, j'aimerais que lors de l'ouverture de cette nouvelle boite de dialogue, deux-trois fonctions soient éxécutées puis qu'on affiche le résultat dans les édit box de la boite de dialogue. Cepandant, les fonctions sont bien éxécutées, mais rien s'affiche dans les édit box:

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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
 
#include "stdafx.h"
#include "AutoMédical.h"
#include "LOAD_PATIENT.h"
#include "mysql.h"
#include <conio.h>
#include <time.h>
 
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
 
//*******************//
//Variables externes patient//
CString	m_loadnom;// Boite de dialogue principale
CString	m_loadprenom;//Boite de dialogue principale
 
//Variables externes de Connexion
int Connexion(); // Fonction déclarée dans Ceer.cpp
MYSQL *mysqlconnexion;
MYSQL_ROW myROW;
MYSQL_RES *myRES;
char query_buff[255];
 
//Variables locales//
CString tempSuivi,tempAdresse,tempNaissance,tempCP,ID_table_patient,tempDate;
CString Naissance_patient(CString m_load_nom2,CString m_load_prenom2);
CString table_suivi(CString id);
 
/////////////////////////////////////////////////////////////////////////////
// LOAD_PATIENT dialog
 
BOOL LOAD_PATIENT::OnInitDialog()
{
	CDialog::OnInitDialog();
 
	// Add "About..." menu item to system menu.
 
	// IDM_ABOUTBOX must be in the system command range.
	ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
	ASSERT(IDM_ABOUTBOX < 0xF000);
 
	CMenu* pSysMenu = GetSystemMenu(FALSE);
	if (pSysMenu != NULL)
	{
		CString strAboutMenu;
		strAboutMenu.LoadString(IDS_ABOUTBOX);
		if (!strAboutMenu.IsEmpty())
		{
			pSysMenu->AppendMenu(MF_SEPARATOR);
			pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
		}
	}
 
	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon
 
	//ICI ON PLACE L'INITIALISATION PROPRE DU PROGRAMME
	Connexion();
	Naissance_patient(m_load_nom,m_load_prenom);
	table_suivi(ID_table_patient);
 
	return TRUE;  // return TRUE  unless you set the focus to a control
}
 
 
LOAD_PATIENT::LOAD_PATIENT(CWnd* pParent /*=NULL*/)
	: CDialog(LOAD_PATIENT::IDD, pParent)
{
	//{{AFX_DATA_INIT(LOAD_PATIENT)
	m_add_suivi = _T("");
	m_load_adresse = _T(tempAdresse);
	m_load_antecedant = _T(tempSuivi);
	m_load_CP = _T(tempCP);
	m_load_naissance = _T(tempNaissance);
	m_load_nom = _T(m_loadnom);
	m_load_prenom = _T(m_loadprenom);
	//}}AFX_DATA_INIT
}
 
 
void LOAD_PATIENT::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(LOAD_PATIENT)
	DDX_Text(pDX, IDC_add_suivi, m_add_suivi);
	DDX_Text(pDX, IDC_loadadresse, m_load_adresse);
	DDX_Text(pDX, IDC_loadantecedant, m_load_antecedant);
	DDX_Text(pDX, IDC_loadcodepostal, m_load_CP);
	DDX_Text(pDX, IDC_loadnaissance, m_load_naissance);
	DDX_Text(pDX, IDC_loadnom, m_load_nom);
	DDX_Text(pDX, IDC_loadprenom, m_load_prenom);
	//}}AFX_DATA_MAP
}
 
 
BEGIN_MESSAGE_MAP(LOAD_PATIENT, CDialog)
	//{{AFX_MSG_MAP(LOAD_PATIENT)
		// NOTE: the ClassWizard will add message map macros here
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()
Les fonctions Naissance_patient et table_suivi retournent:
tempAdresse);
tempSuivi
tempCP
tempNaissance

Je me suis rendu compte à l'aide d'édit box que lors de l'ouverture de la boite de dialogue, celle-ci éxécute d'abord:

LOAD_PATIENT::LOAD_PATIENT(CWnd* pParent /*=NULL*/)
: CDialog(LOAD_PATIENT::IDD, pParent

pui après
BOOL LOAD_PATIENT::OnInitDialog()

Alors qu'il faudrais faire l'inverse. Ce qui justifie le fait que rien ne s'affiche

Merci d'avance,
Florian