首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

error C2664: 'GetClientRect' : cannot convert parameter 一 from 's

2013-11-29 
error C2664: 'GetClientRect' : cannot convert parameter 1 from 'struct CvRect *CvRec

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);

热点排行