出现了错误:error C2664
编号:QA003166
建立日期: 2000年7月16日 最后修改日期:2000年7月16日
所属类别:
qxb:
操作系统: win98
编程工具: vc6
问题: 我在程序中想使用一个win32API函数,语句如下:
HWND hwnd;
LPTSTR str;
hwnd=::GetWindow(this,GW_HWNDPREV);
::GetWindowText(hwnd,str,30);
m_EditStr=str;
UpdateData(FALSE);
但出现了以下错误:
error C2664: 'GetWindow' : cannot convert parameter 1 from 'class CMyDlg *const ' to 'struct HWND__ *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
我已经在.cpp中加入了windows.h,请问问题出在何处,谢谢!!!
水平: 刚入门
回答:
对于你的例子,this操作符表示对话框,VC无法将一个对话框转换为句柄,你应该使用m_hWnd代替this。
相关问题:
QA001590 "如何获得控件的句柄"
此问题由李海回答。
| |
|
|
| |
|
|