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. Getting size of the list window.

Getting size of the list window.

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestion
5 Posts 4 Posters 1 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.
  • S Offline
    S Offline
    sthalasayanam
    wrote on last edited by
    #1

    Can I call GetClientRect() to retrieve the size of the list window ( a child control to the dialog) in the constructor of the dialog box. Example: CMyDialog::CMyDialog() { CRect rect; m_List.GetClientRect(&rect); } Normally, the function is invoked in the InitDialog() function?. I am bit confused about this. thanks for help in advance NSS

    D Mircea PuiuM 2 Replies Last reply
    0
    • S sthalasayanam

      Can I call GetClientRect() to retrieve the size of the list window ( a child control to the dialog) in the constructor of the dialog box. Example: CMyDialog::CMyDialog() { CRect rect; m_List.GetClientRect(&rect); } Normally, the function is invoked in the InitDialog() function?. I am bit confused about this. thanks for help in advance NSS

      D Offline
      D Offline
      Dreamz
      wrote on last edited by
      #2

      No,You can call the function only after your control is created.

      1 Reply Last reply
      0
      • S sthalasayanam

        Can I call GetClientRect() to retrieve the size of the list window ( a child control to the dialog) in the constructor of the dialog box. Example: CMyDialog::CMyDialog() { CRect rect; m_List.GetClientRect(&rect); } Normally, the function is invoked in the InitDialog() function?. I am bit confused about this. thanks for help in advance NSS

        Mircea PuiuM Offline
        Mircea PuiuM Offline
        Mircea Puiu
        wrote on last edited by
        #3

        Probably you are interested in doing something like this in the constructor:

        CListCtrl \*pW = (CListCtrl \*)GetDlgItem(IDC\_LIST1);
        CRect rc;
        if ( pW ) 
        {
        	pW->GetClientRect(&rc);
        	int z = 1; // Debug point
        }
        

        When executing the first line, you come to the following assertion: ASSERT(::IsWindow(m_hWnd)) which actually tells you that the child window is not a window yet. That is why you have to place the code in OnInitDialog() SkyWalker -- modified at 3:10 Monday 10th October, 2005

        A S 2 Replies Last reply
        0
        • Mircea PuiuM Mircea Puiu

          Probably you are interested in doing something like this in the constructor:

          CListCtrl \*pW = (CListCtrl \*)GetDlgItem(IDC\_LIST1);
          CRect rc;
          if ( pW ) 
          {
          	pW->GetClientRect(&rc);
          	int z = 1; // Debug point
          }
          

          When executing the first line, you come to the following assertion: ASSERT(::IsWindow(m_hWnd)) which actually tells you that the child window is not a window yet. That is why you have to place the code in OnInitDialog() SkyWalker -- modified at 3:10 Monday 10th October, 2005

          A Offline
          A Offline
          Anonymous
          wrote on last edited by
          #4

          Thanks for your help.

          1 Reply Last reply
          0
          • Mircea PuiuM Mircea Puiu

            Probably you are interested in doing something like this in the constructor:

            CListCtrl \*pW = (CListCtrl \*)GetDlgItem(IDC\_LIST1);
            CRect rc;
            if ( pW ) 
            {
            	pW->GetClientRect(&rc);
            	int z = 1; // Debug point
            }
            

            When executing the first line, you come to the following assertion: ASSERT(::IsWindow(m_hWnd)) which actually tells you that the child window is not a window yet. That is why you have to place the code in OnInitDialog() SkyWalker -- modified at 3:10 Monday 10th October, 2005

            S Offline
            S Offline
            sthalasayanam
            wrote on last edited by
            #5

            Thanks for your help. NSS

            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