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. Dynamically resize dialog

Dynamically resize dialog

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

    Hello :), I have a dialog based application. On a menu command I need to hide sone controls (edit box and buttons) and I can do it (setting as not visible) Now I need to resize the main dialog, since there is an empty area. I tried with this (IDD_TEST_GUI_DIALOG is the ID of the main dialog window): CWnd* pWnd = GetDlgItem(IDD_TEST_GUI_DIALOG); RECT rc; pWnd->GetWindowRect(&rc); rc.right -= 100; ScreenToClient(&rc); pWnd->MoveWindow(&rc); but I get an error. If, instead of IDD_TEST_GUI_DIALOG, I put the ID of any other child element the function works. What did I do wrong? In debugging I find that, after GetDlgItem pWnd is 00000 Thanks in advance :) Marco.

    V E 2 Replies Last reply
    0
    • M marcomars

      Hello :), I have a dialog based application. On a menu command I need to hide sone controls (edit box and buttons) and I can do it (setting as not visible) Now I need to resize the main dialog, since there is an empty area. I tried with this (IDD_TEST_GUI_DIALOG is the ID of the main dialog window): CWnd* pWnd = GetDlgItem(IDD_TEST_GUI_DIALOG); RECT rc; pWnd->GetWindowRect(&rc); rc.right -= 100; ScreenToClient(&rc); pWnd->MoveWindow(&rc); but I get an error. If, instead of IDD_TEST_GUI_DIALOG, I put the ID of any other child element the function works. What did I do wrong? In debugging I find that, after GetDlgItem pWnd is 00000 Thanks in advance :) Marco.

      V Offline
      V Offline
      V 0
      wrote on last edited by
      #2

      for some reason it's not possible to do a GetDlgItem on a dialog (IDD_...) You can however, resize and shift your controls in your dialog. Maybe that's a solution? Their is a way to resize your dialog, but I have no idea on how. Is there no article about this? "If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimmy Hendrix

      1 Reply Last reply
      0
      • M marcomars

        Hello :), I have a dialog based application. On a menu command I need to hide sone controls (edit box and buttons) and I can do it (setting as not visible) Now I need to resize the main dialog, since there is an empty area. I tried with this (IDD_TEST_GUI_DIALOG is the ID of the main dialog window): CWnd* pWnd = GetDlgItem(IDD_TEST_GUI_DIALOG); RECT rc; pWnd->GetWindowRect(&rc); rc.right -= 100; ScreenToClient(&rc); pWnd->MoveWindow(&rc); but I get an error. If, instead of IDD_TEST_GUI_DIALOG, I put the ID of any other child element the function works. What did I do wrong? In debugging I find that, after GetDlgItem pWnd is 00000 Thanks in advance :) Marco.

        E Offline
        E Offline
        Edwin Brunner
        wrote on last edited by
        #3

        Why do you try to get a pointer to your own class? Try this code: GetWindowRect(&rc); rc.right -= 100; ScreenToClient(&rc); MoveWindow(&rc);

        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