WTL学习(2)

有如下例子代码一段 BEGIN_DDX_MAP(CMainDlg) DDX_CONTROL(IDC_EDIT, m_wndEdit) DDX_TEXT(IDC_EDIT, m_sEditContents) DDX_INT(IDC_EDIT, m_nEditNumber) END_DDX_MAP() 也就是《MFC程序员的WTL指南》中的一段 有一个问题:DDX_TEXT这一句会报错说不能把m_sEditContents这个CString转换成char* 网上找到了答案 这兄台叫Ruben >My problem is: >I am trying to do a Dialog application, >but when I've tried to use CString with DDX_TEXT macro I've had >problems and it didn't accept this TYPE of variable. > >Anybody knows why DDX_TEXT hasn´t accepted this TYPE of variable? > >It gives me a error message like this: > >error C2664: 'int __thiscall >WTL::CWinDataExchangeCMainDlg>::DDX_Text(unsigned int,char >*,int,int,int,int)' : cannot convert >parameter 2 from 'class WTL::CString' to 'char *' >No user-defined-conversion operator available that can perform this >conversion, or the operator cannot be called > >Anybody knows how can I solve this problem? > >Thanks in advances 答案是 hi Ruben, try including before including in your stdafx.h fileor your app's .cpp file. 在书中,是在stdafx.h中加入了atlddx.h,再在里面加上atlmisc.h就行了 清单如下 // stdafx.h : include file for standard system include files, // or project specific include files that are used frequently, but // are changed infrequently // #if !defined(AFX_STDAFX_H__4B9E2575_63C6_4F0D_BBA2_6E5B6F236611__INCLUDED_) #define AFX_STDAFX_H__4B9E2575_63C6_4F0D_BBA2_6E5B6F236611__INCLUDED_ // Change these values to use different versions #define WINVER 0x0400 //#define _WIN32_WINNT 0x0400 #define _WIN32_IE 0x0400 #define _RICHEDIT_VER 0x0100 #include #include extern CAppModule _Module; #include #include #include #include #include #include #include //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_STDAFX_H__4B9E2575_63C6_4F0D_BBA2_6E5B6F236611__INCLUDED_) 最开始还有一个CPoint类认不出来,这是另外一个问题了,不过现在已经解决,不知道怎么解决的,难道与安装SDK有关? 当时总是提示.sbr文件找不着,网上的办法是删掉.ncb文件,暂时不懂有什么关系,不过做了似乎也没有效果。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值