Home > Software engineering >  C2660:1 the parameters' ScreenToClient 'funtion does not take the solution
C2660:1 the parameters' ScreenToClient 'funtion does not take the solution

Time:11-03

Help!!!!!! Thank you very much!!!!!! C2660: 'ScreenToClient' funtion does not take the parameters solution 1
The code below

Void CMyDlg: : ChangeSize (UINT nID, int x, int y)//nID to control ID, x, y, respectively, of the length and width of the dialog
{
The CWnd * pWnd.
Void CWnd: : GetDlgItem (int nID, HWND * PHWND) const;
If (pWnd!=NULL)//determine whether is empty, because when creating the window will call OnSize function, but each control has not yet been created, Pwnd is empty
{
CRect rec.
PWnd - & gt; GetWindowRect (& amp; Rec);//access controls the size of the change before

ScreenToClient (& amp; Rec); //the control size transposition area coordinates in the dialog

Rec. Left=rec. Left * x/m_rect Width ();//in accordance with the proportion of new position adjustment space
Rec. Top=rec. Top * y/m_rect Height ();
Rec. Bottom=rec. Bottom * y/m_rect Height ();
Rec. Right=rec. Right. * x/m_rect Width ();
PWnd - & gt; MoveWindow (rec);//slip control
}
}


CodePudding user response:

ChangeSize statement to the static type? Remove the
Another CWnd * pWnd=GetDlgItem (nID);

CodePudding user response:

Thank you for your answer! The CWnd * pWnd=GetDlgItem (nID); So right!
I was just a primer, can you tell me where I can see ChangeSize statement to the static type? please do.

CodePudding user response:

The CWnd: : ScreenToClient
Void ScreenToClient (LPPOINT LPPOINT) const;
Void ScreenToClient (LPRECT LPRECT) const;
This is the CWnd class

BOOL ScreenToClient (
The HWND HWND,//the window handle for the source coordinates
LPPOINT LPPOINT//address of structure containing coordinates
);
This is a Windows API

CodePudding user response:

Thank you very much! I see ~
  • Related