问题描述
- GetDlgItem(IDC)->SetWindowText(strsampletime)
-
GetDlgItem(IDC_TIMES)->SetWindowText(strsampletime)报错,错误如下:
C:UsersAdministratorDesktop圆盘检测StillCapStillCapDlg.cpp(134) : error C2660: 'GetDlgItem' : function does not take 1 parameters
C:UsersAdministratorDesktop圆盘检测StillCapStillCapDlg.cpp(134) : error C2227: left of '->SetWindowTextA' must point to class/struct/union但是我重新建立一个工程,输入 GetDlgItem(IDC_TIMES)->SetWindowText(strsampletime);,不报错,成功了,
请问这是什么原因引起的?该如何解决?
解决方案
你调用的是API的GetDlgItem
应该是this->GetDlgItem(IDC)->SetWindowText(strsampletime)
解决方案二:
GetDlgItem 要看在哪里调用,如果是成员函数中,那么就是缺省用的当前this指针
解决方案三:
不行啊,改了仍报错:,错误变成一下的了:
C:UsersAdministratorDesktop圆盘检测StillCapStillCapDlg.cpp(134) : error C2039: 'GetDlgItem' : is not a member of 'CSampleGrabberCB'
C:UsersAdministratorDesktop圆盘检测StillCapStillCapDlg.cpp(62) : see declaration of 'CSampleGrabberCB'
C:UsersAdministratorDesktop圆盘检测StillCapStillCapDlg.cpp(134) : error C2227: left of '->SetWindowTextA' must point to class/struct/union
解决方案四:
不行啊,改了仍报错:,错误变成一下的了:
C:UsersAdministratorDesktop圆盘检测StillCapStillCapDlg.cpp(134) : error C2039: 'GetDlgItem' : is not a member of 'CSampleGrabberCB'
C:UsersAdministratorDesktop圆盘检测StillCapStillCapDlg.cpp(62) : see declaration of 'CSampleGrabberCB'
C:UsersAdministratorDesktop圆盘检测StillCapStillCapDlg.cpp(134) : error C2227: left of '->SetWindowTextA' must point to class/struct/union