coordinates of a child window bug??
-
I wanted to know the coordinate of a child window in relation to a parent window. To recap my resource script
EDITTEXT IDC_EDIT1,34,50,26,14,ES_AUTOHSCROLL | NOT WS_BORDER PUSHBUTTON "&Size Info",IDC_SIZE_INFO,69,91,56,26
Someone replied (thanks) saying that i code as follows:CPoint pt(0,0); //initialised to zero for calculations child->ClientToScreen(&pt); // called from the child window parent->ScreenToClient(&pt); // called from the parent window
My problem is that not getting the correct correct coordinates can anyone explain why it's happening and how to I go about doing it. Many thanks in advance. Alton -
I wanted to know the coordinate of a child window in relation to a parent window. To recap my resource script
EDITTEXT IDC_EDIT1,34,50,26,14,ES_AUTOHSCROLL | NOT WS_BORDER PUSHBUTTON "&Size Info",IDC_SIZE_INFO,69,91,56,26
Someone replied (thanks) saying that i code as follows:CPoint pt(0,0); //initialised to zero for calculations child->ClientToScreen(&pt); // called from the child window parent->ScreenToClient(&pt); // called from the parent window
My problem is that not getting the correct correct coordinates can anyone explain why it's happening and how to I go about doing it. Many thanks in advance. AltonTo get a client rectangle of a child do the following:
CRect crChild;
pWndChild->GetWindowRect(&crChild);
ScreenToClient(&crChild);Things to Note: This is called from the CWnd derived class of the parent. pWndChild is a pointer to the child window you want the coordinates for. Ant.
-
I wanted to know the coordinate of a child window in relation to a parent window. To recap my resource script
EDITTEXT IDC_EDIT1,34,50,26,14,ES_AUTOHSCROLL | NOT WS_BORDER PUSHBUTTON "&Size Info",IDC_SIZE_INFO,69,91,56,26
Someone replied (thanks) saying that i code as follows:CPoint pt(0,0); //initialised to zero for calculations child->ClientToScreen(&pt); // called from the child window parent->ScreenToClient(&pt); // called from the parent window
My problem is that not getting the correct correct coordinates can anyone explain why it's happening and how to I go about doing it. Many thanks in advance. AltonCoordinates in a resource file are specified in dialog base units, while coordinates used in Windows get/move/size APIs are specified in pixels.
GetDialogBaseUnits()
is one method you can use to convert between the two. /ravi My new year's resolution: 2048 x 1536 Home | Articles | Freeware | Music ravib@ravib.com