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. Help!!! How to set position of a dialog

Help!!! How to set position of a dialog

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelptutorial
3 Posts 2 Posters 2 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.
  • V Offline
    V Offline
    VikramDelhi i
    wrote on last edited by
    #1

    Hi i want to know how to set the position of the dialog to the right bottom corner of the screen.i used GetSystemMetrics to get the resolution (infact) width and height of the desktop screen. but how can i retrive width and height of dialog? And how to retrive the hieght of the TaskBar. 1.if i get width and height of dialog,i can use SetWindowPos(...) 2.what about the tsakbar????

    D 1 Reply Last reply
    0
    • V VikramDelhi i

      Hi i want to know how to set the position of the dialog to the right bottom corner of the screen.i used GetSystemMetrics to get the resolution (infact) width and height of the desktop screen. but how can i retrive width and height of dialog? And how to retrive the hieght of the TaskBar. 1.if i get width and height of dialog,i can use SetWindowPos(...) 2.what about the tsakbar????

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

      Something like this in your dialog's init method:

      RECT rcDisplay,
      rcDialog;

      SystemParametersInfo(SPI_GETWORKAREA, 0, &rcDisplay, 0);
      GetWindowRect(&rcDialog);
      rcDialog.left = rcDisplay.right - rcDialog.right;
      rcDialog.top = rcDisplay.bottom - rcDialog.bottom;
      rcDialog.right = rcDisplay.right;
      rcDialog.bottom = rcDisplay.bottom;

      MoveWindow(&rcDialog);


      "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

      V 1 Reply Last reply
      0
      • D David Crow

        Something like this in your dialog's init method:

        RECT rcDisplay,
        rcDialog;

        SystemParametersInfo(SPI_GETWORKAREA, 0, &rcDisplay, 0);
        GetWindowRect(&rcDialog);
        rcDialog.left = rcDisplay.right - rcDialog.right;
        rcDialog.top = rcDisplay.bottom - rcDialog.bottom;
        rcDialog.right = rcDisplay.right;
        rcDialog.bottom = rcDisplay.bottom;

        MoveWindow(&rcDialog);


        "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

        V Offline
        V Offline
        VikramDelhi i
        wrote on last edited by
        #3

        hi DavidCrow thanks a lot for help! :)

        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