Getting the coordinate of a child window
-
I having a problem with a control (say an edit box) on a Dialogue or FormView. in my resource script is as follows
EDITTEXT IDC_EDIT1,34,50,26,14,ES_AUTOHSCROLL | NOT WS_BORDER PUSHBUTTON "&Size Info",IDC_SIZE_INFO,69,91,56,26
I've a handler for the button as follows:void CMyDialog::OnSizeInfo() { CRect ButtonRect, EditRect; CWnd *pEdit = GetDlgItem(IDC_EDIT1); CWnd *pButton = GetDlgItem(IDC_SIZE_INFO); pEdit->GetClientRect(EditRect); pButton->GetClientRect(ButtonRect); }
void CMyDialog::OnSizeInfo() { CRect ButtonRect, EditRect; CWnd *pEdit = GetDlgItem(IDC_EDIT1); CWnd *pButton = GetDlgItem(IDC_SIZE_INFO); pEdit->GetWindowRect(EditRect); pButton->GetWindowRect(ButtonRect); }
void CMyDialog::OnSizeInfo() { CRect ButtonRect, EditRect; CWnd *pEdit = GetDlgItem(IDC_EDIT1); CWnd *pButton = GetDlgItem(IDC_SIZE_INFO); ::GetClientRect(pEdit,EditRect); ::GetClientRect(pButton,ButtonRect); }
void CMyDialog::OnSizeInfo() { CRect ButtonRect, EditRect; CWnd *pEdit = GetDlgItem(IDC_EDIT1); CWnd *pButton = GetDlgItem(IDC_SIZE_INFO); ::GetWindowRect(pEdit,EditRect); ::GetWindowRect(pButton,ButtonRect); }
in all cases the top and left properties are 0 and 0 and not 34 and 50 (EditRect) or 69 and 91 (ButtonRect). How I get this programatically. Many thanks Alton
-
I having a problem with a control (say an edit box) on a Dialogue or FormView. in my resource script is as follows
EDITTEXT IDC_EDIT1,34,50,26,14,ES_AUTOHSCROLL | NOT WS_BORDER PUSHBUTTON "&Size Info",IDC_SIZE_INFO,69,91,56,26
I've a handler for the button as follows:void CMyDialog::OnSizeInfo() { CRect ButtonRect, EditRect; CWnd *pEdit = GetDlgItem(IDC_EDIT1); CWnd *pButton = GetDlgItem(IDC_SIZE_INFO); pEdit->GetClientRect(EditRect); pButton->GetClientRect(ButtonRect); }
void CMyDialog::OnSizeInfo() { CRect ButtonRect, EditRect; CWnd *pEdit = GetDlgItem(IDC_EDIT1); CWnd *pButton = GetDlgItem(IDC_SIZE_INFO); pEdit->GetWindowRect(EditRect); pButton->GetWindowRect(ButtonRect); }
void CMyDialog::OnSizeInfo() { CRect ButtonRect, EditRect; CWnd *pEdit = GetDlgItem(IDC_EDIT1); CWnd *pButton = GetDlgItem(IDC_SIZE_INFO); ::GetClientRect(pEdit,EditRect); ::GetClientRect(pButton,ButtonRect); }
void CMyDialog::OnSizeInfo() { CRect ButtonRect, EditRect; CWnd *pEdit = GetDlgItem(IDC_EDIT1); CWnd *pButton = GetDlgItem(IDC_SIZE_INFO); ::GetWindowRect(pEdit,EditRect); ::GetWindowRect(pButton,ButtonRect); }
in all cases the top and left properties are 0 and 0 and not 34 and 50 (EditRect) or 69 and 91 (ButtonRect). How I get this programatically. Many thanks Alton