Usage of CArray<> with a CListCtrl derrived class.
-
I got a small problem :eek:... I'm using CArray<> which I define like this: typedef CArray<"CListCtrlEx, CListCtrlEx&"> Type_aCListCtrlEx; Type_aCListCtrlEx m_aCListCtrlEx; (WHEN I PREVIEWED THE POSTING I HAD PROBLEMS WITH <> THEREFOR I ADDED THE " SO THAT NO CODING ERROR) Where CListCtrlEx is a CListCtrl derrived class. Then I do this to add a new CListCtrlEx class to the array: CListCtrlEx wndList; m_aCListCtrlEx.Add(wndList); The problem is that it first gave me copy contructor needed and =operator not found error. So I tried to solve it in the CListCtrlEx class like this: HWND operator=(CListCtrlEx &s) { return s.GetSafeHwnd(); } CListCtrlEx(const CListCtrlEx &s) {} I do not know if this is the correct way to do it. But when I try to retrive the CListCtrl wnd handle to use its methods etc like this it doesn't work: CListCtrlEx wnd; wnd = m_aCListCtrlEx.GetAt(0); If someone could gimme a few hints I would be forever greatfull :-D... Cheers, Henrik
-
I got a small problem :eek:... I'm using CArray<> which I define like this: typedef CArray<"CListCtrlEx, CListCtrlEx&"> Type_aCListCtrlEx; Type_aCListCtrlEx m_aCListCtrlEx; (WHEN I PREVIEWED THE POSTING I HAD PROBLEMS WITH <> THEREFOR I ADDED THE " SO THAT NO CODING ERROR) Where CListCtrlEx is a CListCtrl derrived class. Then I do this to add a new CListCtrlEx class to the array: CListCtrlEx wndList; m_aCListCtrlEx.Add(wndList); The problem is that it first gave me copy contructor needed and =operator not found error. So I tried to solve it in the CListCtrlEx class like this: HWND operator=(CListCtrlEx &s) { return s.GetSafeHwnd(); } CListCtrlEx(const CListCtrlEx &s) {} I do not know if this is the correct way to do it. But when I try to retrive the CListCtrl wnd handle to use its methods etc like this it doesn't work: CListCtrlEx wnd; wnd = m_aCListCtrlEx.GetAt(0); If someone could gimme a few hints I would be forever greatfull :-D... Cheers, Henrik
try using pointers to the list controls, instead of references. this way, you avoid "=" operator problems, construction and destruction problems. -c
-
try using pointers to the list controls, instead of references. this way, you avoid "=" operator problems, construction and destruction problems. -c