Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8295071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T14:27:23+00:00 2026-06-08T14:27:23+00:00

I have created a Dialog Box in a c++ windows application (using ATL lib)

  • 0

I have created a Dialog Box in a c++ windows application (using ATL lib) and I have set on it three buttons. The button lie as usual at the bottom of the Dialog Box. I want by the resize of the Dialog Box, the button to retain their position at the bottom of it. In other words, they should keep a constant (low) distance from the bottom margin and the on side (right or left) of the Dialog Box. To bring this into effect, I try to move the buttons accordingly while the Dialog Box size is changed. I use the following code (as example only with the OK button), but the only result is the button to disappear during the resize. How should I modify the code in order for the button to retain its distance from the bottom and the right side of the Dialog Box?

LRESULT RenameFolderDlg::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
RECT r;
GetWindowRect(&r);

CWindow okB(GetDlgItem(IDOK));
RECT okR;
okB.GetWindowRect(&okR);

okB.MoveWindow( r.right - 80 , r.bottom - 40, okR.right - okR.left, okR.bottom -     okR.top, 1);

return 0;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T14:27:25+00:00Added an answer on June 8, 2026 at 2:27 pm

    Instead of

    GetWindowRect(&r);
    

    you shall use

    GetClientRect(&r);
    

    because the coordinates returned by GetWindowRect are relative to the upper-left corner of the screen, while MoveWindow called for a child control expects they are relative to the upper-left corner of the parent window’s client area.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using windows forms application using C#. I have created a dialog box
In my application, I have created a dialog box to accept password. In the
I have created an installer for my windows application using C#. After installing the
I have created a dialog box in my WinForms application. This has many text
I have created a dialog box in my MFC app as below: BackfaceControlPoints *controlpoints
I have a dialog box, created with the code javascript and HTML generated below.
I have created a Dialog with two buttons Yes, No, and then I have
I have created an application in c++ using VS .Net. There is only the
I have created a user login Dialog Box in MFC, which have two edit
I have some code to create a basic dialog box with several options -

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.