Click here to Skip to main content
15,920,687 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: file manager Pin
David Crow11-Dec-03 9:01
David Crow11-Dec-03 9:01 
GeneralRe: file manager Pin
thes3cr3t111-Dec-03 11:01
thes3cr3t111-Dec-03 11:01 
GeneralRe: file manager Pin
David Crow12-Dec-03 2:41
David Crow12-Dec-03 2:41 
GeneralRe: file manager Pin
thes3cr3t112-Dec-03 5:40
thes3cr3t112-Dec-03 5:40 
GeneralRe: file manager Pin
David Crow12-Dec-03 5:44
David Crow12-Dec-03 5:44 
GeneralRe: file manager Pin
thes3cr3t112-Dec-03 6:00
thes3cr3t112-Dec-03 6:00 
QuestionHow to create buttons on the video Pin
Chinnaa Ganesh Kumar11-Dec-03 6:40
Chinnaa Ganesh Kumar11-Dec-03 6:40 
GeneralParent and child dialog, GetWindowRect() Pin
J.B.11-Dec-03 5:29
J.B.11-Dec-03 5:29 
Guys,
I am tring to dynamically move the positions of the child dialogs whenever the parent dialog is resized. But I started getting confused with the values passed to GetWindowPos for the dialogs.

Bsically, I have a parent dialog class, CMyDlg and the dialog contains a Group Box (IDC_SUBFRAME). the child dialog (CMainDlg) should fall into the centre of IDC_SUBFRAME. In CMyDlg::OnInitDialog(), I embedded the child dialog with following code:

CRect frameRect, childRect;

     (GetDlgItem(IDC_SUBFRAME))->GetWindowRect(&frameRect);

pMainDlg = new CMainDlg();
pMainDlg->Create(IDD_MAIN_DIALOG, this);
pMainDlg->GetWindowRect(&childRect);
pMainDlg->SetWindowPos(this, frameRect.left + ((frameRect.Width() - childRect.Width())/2),
    frameRect.top + ((frameRect.Height() - childRect.Width()) / 2),
    childRect.Width(), childRect.Height(), SWP_NOZORDER);
pMainDlg->ShowWindow(SW_SHOW);


I found the child dialog was sitting in the Group Box frame, but not quite at the centre. Through the debug, I found the values of the CRects are quite strange:

frameRect {top=150 bottom=472 left=13 right=600}
childRect {top=30 bottom=132 left=4 right=517}

How come the frame's top and left are larger than the child dialog's, when the child dialog actually sits IN the frame when initialised. To better illustrate, the big box below is the frameRect and the small box within is the childRect.

---------------------
|                   |
|  ---------------  |
|  |             |  |
|  ---------------  |
---------------------


From my understanding, GetWindowRect returns the coordinations in relation to the display (monitor). If so, wouldn't the frame's top and left values be smaller than the child dialog's?

Could anyone help me on this?
Thanks
GeneralRe: Parent and child dialog, GetWindowRect() Pin
georgiek5011-Dec-03 5:50
georgiek5011-Dec-03 5:50 
GeneralRe: Parent and child dialog, GetWindowRect() Pin
J.B.11-Dec-03 15:26
J.B.11-Dec-03 15:26 
GeneralRe: Parent and child dialog, GetWindowRect() Pin
georgiek5011-Dec-03 16:17
georgiek5011-Dec-03 16:17 
GeneralRe: Parent and child dialog, GetWindowRect() Pin
J.B.11-Dec-03 16:39
J.B.11-Dec-03 16:39 
GeneralRe: Parent and child dialog, GetWindowRect() Pin
georgiek5011-Dec-03 18:33
georgiek5011-Dec-03 18:33 
GeneralRe: Parent and child dialog, GetWindowRect() Pin
J.B.12-Dec-03 16:39
J.B.12-Dec-03 16:39 
GeneralRe: Parent and child dialog, GetWindowRect() Pin
J.B.12-Dec-03 17:18
J.B.12-Dec-03 17:18 
GeneralProper way to process messages to modeless dialogs Pin
georgiek5011-Dec-03 5:22
georgiek5011-Dec-03 5:22 
GeneralUpper case Pin
Anonymous11-Dec-03 5:17
Anonymous11-Dec-03 5:17 
GeneralRe: Upper case Pin
valikac11-Dec-03 6:04
valikac11-Dec-03 6:04 
GeneralRe: Upper case Pin
Anonymous11-Dec-03 6:46
Anonymous11-Dec-03 6:46 
GeneralRe: Upper case Pin
Joe Woodbury11-Dec-03 6:59
professionalJoe Woodbury11-Dec-03 6:59 
GeneralSend virtual Ctrl-Alt-Del Pin
Albert Jann11-Dec-03 5:07
Albert Jann11-Dec-03 5:07 
GeneralRe: Send virtual Ctrl-Alt-Del Pin
David Crow11-Dec-03 7:31
David Crow11-Dec-03 7:31 
GeneralRe: Send virtual Ctrl-Alt-Del. I already found the answer Pin
Albert Jann11-Dec-03 9:09
Albert Jann11-Dec-03 9:09 
GeneralSending paste message to another application Pin
MB_OK11-Dec-03 3:49
MB_OK11-Dec-03 3:49 
GeneralRe: Sending paste message to another application Pin
MB_OK11-Dec-03 20:30
MB_OK11-Dec-03 20:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.