Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Client vs whole window coordinates

Status
Not open for further replies.

HyperEngineer

Programmer
May 8, 2002
190
US
I'm trying to get the coordinates for the client section and the whole window. This is the code, but it gives me the same top, bottom, left and right for both the client and the window.

The files are:

T1NIU.h
T1NIU.cpp
T1NIUDlg.h
T1NIUDlg.cpp

This code is in the T1NIUDlg.cpp
Code:
  CClientDC dlgDC(this);
  CWindowDC frmDC(m_pMainDialog);

  CWnd* frameWindow = frmDC.GetWindow();
  CWnd* clientWindow = dlgDC.GetWindow();

  RECT MyRect;
  RECT MyWinRect;
  RECT MyStatusRect;

  clientWindow->GetWindowRect(&MyRect);
  frameWindow->GetWindowRect(&MyWinRect);

  CString sWindowRect;
  sWindowRect.Format("My Window\nTop = %d\nBottom = %d\nLeft = %d\nRight = %d",
         MyWinRect.top, MyWinRect.bottom, MyWinRect.left, MyWinRect.right);
  MessageBox(sWindowRect);

  CString MyClientRect;
  MyClientRect.Format("Top = %ld\nBottom = %ld\nLeft = %ld\nRight = %ld",
         MyRect.top, MyRect.bottom, MyRect.left, MyRect.right);
  MessageBox(MyClientRect);

The variable m_pMainDialog is a member function of the dialog box and is defined in the T1NIUDlg.h file:
Code:
  CWnd* m_pMainDialog;

It is set to the address of the dialog box in the T1NIU.cpp file:
Code:
  CT1NIUDlg dlg;
  m_pMainWnd = &dlg;          // CWnd* defined in AFXWIN.H
  dlg.m_pMainDialog = m_pMainWnd;

I must not be understanding something here. Is the this parameter the same as the address of the dialog box?


HyperEngineer
If it ain't broke, it probably needs improvement.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top