Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Usage of CArray<> with a CListCtrl derrived class.

Usage of CArray<> with a CListCtrl derrived class.

Scheduled Pinned Locked Moved C / C++ / MFC
helpdata-structures
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    Henrik
    wrote on last edited by
    #1

    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

    C 1 Reply Last reply
    0
    • H 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

      C Offline
      C Offline
      Chris Losinger
      wrote on last edited by
      #2

      try using pointers to the list controls, instead of references. this way, you avoid "=" operator problems, construction and destruction problems. -c

      L 1 Reply Last reply
      0
      • C Chris Losinger

        try using pointers to the list controls, instead of references. this way, you avoid "=" operator problems, construction and destruction problems. -c

        L Offline
        L Offline
        leonwoo
        wrote on last edited by
        #3

        There is no copy constructor for the CArray class. So you have to define one by inheriting the CArray class. leonwoo

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups