读书人

error C2664: amp;#x27;GetClientRectamp;#x

发布时间: 2013-11-29 00:21:24 作者: rapoo

error C2664: 'GetClientRect' : cannot convert parameter 1 from 'struct CvRect *
CvRect rect;
CFrameWnd *pFrame=(CFrameWnd*)AfxGetMainWnd();
pFrame->GetActiveView()->GetClientRect(&rect);


请问这个怎么转换啊

在MFC中,该函数的原型为void GetClientRect(LPRECT lpRect) const;

typedef struct CvRect
  {
  int x; /* 方形的左上角的x-坐标 */
  int y; /* 方形的左上角的y-坐标*/
  int width; /* 宽 */
  int height; /* 高 */
  }
typedef struct tagRECT
{
LONG left;
LONG top;
LONG right;
LONG bottom;
} RECT, *PRECT, NEAR *NPRECT, FAR *LPRECT;

这2个结构是一样的,但是GetClientRect的参数是LPRECT,所以你
pFrame->GetActiveView()->GetClientRect((LPRECT)&rect);

读书人网 >C++

热点推荐