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. Child within child?

Child within child?

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
2 Posts 2 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.
  • C Offline
    C Offline
    clintsinger
    wrote on last edited by
    #1

    I have a Doc/View application where I want to put a listview control in the CView derived class. Unforetunately I get the following error when the program runs : "Cannot create a top-level child window" on the two controls that I want in my CView derived class. Ex Defined in the MyView.h CListCtrl m_lstCtrl; In the OnCreate of CMyView m_lstCtrl.Create(WS_CHILD|WS_VISIBLE|WS_BORDER|LVS_REPORT, CRect(0, 120, 200, 200), this, 1); <-Error at this point. What would I be doing wrong? I was pretty sure I could put a child view inside of another childview. As a side note, If I change this to pParentWnd, the list control draws, but the CMyView draws over it. Cheers, Clint

    A 1 Reply Last reply
    0
    • C clintsinger

      I have a Doc/View application where I want to put a listview control in the CView derived class. Unforetunately I get the following error when the program runs : "Cannot create a top-level child window" on the two controls that I want in my CView derived class. Ex Defined in the MyView.h CListCtrl m_lstCtrl; In the OnCreate of CMyView m_lstCtrl.Create(WS_CHILD|WS_VISIBLE|WS_BORDER|LVS_REPORT, CRect(0, 120, 200, 200), this, 1); <-Error at this point. What would I be doing wrong? I was pretty sure I could put a child view inside of another childview. As a side note, If I change this to pParentWnd, the list control draws, but the CMyView draws over it. Cheers, Clint

      A Offline
      A Offline
      Alvaro Mendez
      wrote on last edited by
      #2

      I just created a brand-new SDI project, added the OnCreate handler to the view class, and then your code, and it works fine. I then tried it with a new MDI project and it also works fine. I suggest you try it yourself and check what the difference is. Regards, Alvaro


      The world is a dangerous place, not because of those who do evil, but because of those who look on and do nothing. -- Albert Einstein

      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