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. How to get/set the position of buttons, ListCtrl etc.?

How to get/set the position of buttons, ListCtrl etc.?

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++debuggingtutorialquestion
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.
  • P Offline
    P Offline
    P Rex
    wrote on last edited by
    #1

    Hi all, I tried to get/set the position and size of a ListCtrl in a dialog. When i use the GetClientRect() method i get no values and the programm crashes and starts the debugger. Is it the same way if i want to change the position of buttons and so on? Is anybody out there who can help me with this problem and explain it to me!? (MFC) :(( Thanks P.R.

    S D 2 Replies Last reply
    0
    • P P Rex

      Hi all, I tried to get/set the position and size of a ListCtrl in a dialog. When i use the GetClientRect() method i get no values and the programm crashes and starts the debugger. Is it the same way if i want to change the position of buttons and so on? Is anybody out there who can help me with this problem and explain it to me!? (MFC) :(( Thanks P.R.

      S Offline
      S Offline
      SJolly
      wrote on last edited by
      #2

      Try: RECT stItemRect = {0}; GetDlgItem(IDC_NAME_OF_CONTROL)->GetWindowRect(&stItemRect); This ensures that you are using the correct CWnd item. It gives you all the corners of the item, so you can also work out the size. If this still crashes then I would guess the list control is being declared incorrectly - does it display on screen with those lines commented out? Simon.

      1 Reply Last reply
      0
      • P P Rex

        Hi all, I tried to get/set the position and size of a ListCtrl in a dialog. When i use the GetClientRect() method i get no values and the programm crashes and starts the debugger. Is it the same way if i want to change the position of buttons and so on? Is anybody out there who can help me with this problem and explain it to me!? (MFC) :(( Thanks P.R.

        D Offline
        D Offline
        David Crow
        wrote on last edited by
        #3

        Wee - Man wrote: When i use the GetClientRect() method i get no values and the programm crashes and starts the debugger. Can you provide a code snippet of what you are doing?


        A rich person is not the one who has the most, but the one that needs the least.

        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