作者GooLoo (平凡)
看板C_and_CPP
标题[问题] 类
时间Mon Jan 4 22:49:41 2016
开发平台(Platform): (Ex: VC++, GCC, Linux, ...)
vc++ 6.0
额外使用到的函数库(Library Used): (Ex: OpenGL, ...)
问题(Question):
初次使用VC, 上网看一些短片,
照上面KEY,先练习怎麽设定Label1的文字.
其中,它提到 Wnd类 给指标Label1,并且取得ID, 就可以调用它的参数设定
可是我照做却弄不出来
且....CWnd没出现蓝字...
喂入的资料(Input):
预期的正确结果(Expected Output):
IDC_STATIC 的Test出现ABC
错误结果(Wrong Output):
error C2065: 'GetDlgitem' : undeclared identifier
error C2440: 'initializing' : cannot convert from 'int' to 'class CWnd *'
Conversion from integral type to pointer type requires reinterpret_cast,
C-style cast or function-style cast
程式码(Code):(请善用置底文网页, 记得排版)
void CT02Dlg::OnButton2()
{
CWnd *Label1=GetDlgitem(IDC_STATIC);
Label1->SetWindowText("ABC");
}
补充说明(Supplement):
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 111.251.227.30
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/C_and_CPP/M.1451918983.A.DB9.html
※ 编辑: GooLoo (111.251.227.30), 01/04/2016 22:49:55
※ 编辑: GooLoo (111.251.227.30), 01/04/2016 22:50:41
1F:推 EdisonX: GetDlgItem 01/04 23:02
2F:推 Clangpp: 虽然VC6是一代经典 但是 他已经过时了 建议换到2015吧 01/05 10:30
3F:→ Clangpp: 反正现在都有免费版 除了你有什麽历史的包袱之类的 01/05 10:31
4F:→ GooLoo: 原来是I看成L,感谢 01/05 21:15