Bonjour
size vaut 2
size1 vaut 1 et non 2... je m'attendrais à ce qu'il me liste les 2 contrôles. Sur la boucle while, il ne me récupère que le dernier controle rajouté "control1"
Merci

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
 
struct T_Ctrl
{
		int							tag;
		CString						ctrl;
};
 
struct T_Window
{
		int							tag;
		CString						window;
		CList<T_Ctrl*, T_Ctrl*&>	lt_ctrl;
};
CList<T_Window*, T_Window*&> cl_list;
...
T_Window	* temp_window	= new T_Window();
T_Ctrl	* temp_ctrl		= new T_Ctrl();
 
T_Window	* temp_window1	= new T_Window();
T_Ctrl	* temp_ctrl1	= new T_Ctrl();
 
 
temp_ctrl->ctrl = "control";
temp_window->window = "window";
temp_window->lt_ctrl.AddHead(temp_ctrl);
cl_list.AddHead(temp_window);
 
temp_ctrl1->ctrl = "control1";
temp_window1->window = "window";
temp_window1->lt_ctrl.AddHead(temp_ctrl1);
cl_list.AddHead(temp_window1);
 
 
POSITION pos_window = cl_list.GetHeadPosition();
int size = cl_list.GetCount();
int size1 = cl_list.GetAt(pos_window)->lt_ctrl.GetCount();
POSITION pos_ctrl = cl_list.GetAt(pos_window)->lt_ctrl.GetHeadPosition();
while( pos_ctrl )
{
CString temp =cl_list.GetAt(pos_window)->lt_ctrl.GetAt(pos_ctrl)->ctrl ;
cl_list.GetAt(pos_window)->lt_ctrl.GetNext(pos_ctrl);
}
NIco