| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 578 人关注过本帖
标题:求助!获取编辑框里输入的字符串
只看楼主 加入收藏
qldxsun
Rank: 4
等 级:业余侠客
帖 子:125
专家分:240
注 册:2011-6-4
结帖率:80%
收藏
已结贴  问题点数:20 回复次数:5 
求助!获取编辑框里输入的字符串
void CDDlg::OnChangeEdit1()
{
    // TODO: If this is a RICHEDIT control, the control will not
    // send this notification unless you override the CDialog::OnInitDialog()
    // function and call CRichEditCtrl().SetEventMask()
    // with the ENM_CHANGE flag ORed into the mask.
   
    // TODO: Add your control notification handler code here
    char str【】;
    GetDlgItem(IDC_EDIT1)->GetwindowText(str);
}
用mfc wizard建立了一个对话框,需要读入编辑框里输入的字符串并进行处理,红色部分报错
 error C2039: 'GetwindowText' : is not a member of 'CWnd'
求指教啊!
msdn里对GetwindowText的解释
GetWindowText
The GetWindowText function copies the text of the specified window's title bar (if it has one) into a buffer. If the specified window is a control, the text of the control is copied. However, GetWindowText cannot retrieve the text of a control in another application.

int GetWindowText(
  HWND hWnd,        // handle to window or control
  LPTSTR lpString,  // text buffer
  int nMaxCount     // maximum number of characters to copy
);
Parameters
hWnd
[in] Handle to the window or control containing the text.
lpString
[out] Pointer to the buffer that will receive the text.
nMaxCount
[in] Specifies the maximum number of characters to copy to the buffer, including the NULL character. If the text exceeds this limit, it is truncated.


怎么改呢?不会是我的vc6.0头文件有问题吧。。。

http://zhidao.baidu.com/question/203131774.html
百度有个解释,类似的,为什么改成他说的那样就行了?我的这个怎样改???


后面有一个定义一个cedit变量,这个怎么做?

[ 本帖最后由 qldxsun 于 2011-6-15 23:23 编辑 ]
搜索更多相关主题的帖子: function 字符串 对话框 编辑 function 字符串 对话框 编辑 
2011-06-15 23:09
qldxsun
Rank: 4
等 级:业余侠客
帖 子:125
专家分:240
注 册:2011-6-4
收藏
得分:0 
CWnd *p;
p=GetDlgItem(IDC_EDIT1);
p->GetwindowText(str);
这样是不行的
2011-06-15 23:38
夜叶
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:104
专家分:189
注 册:2011-5-7
收藏
得分:0 
不懂,帮顶
2011-06-15 23:52
qldxsun
Rank: 4
等 级:业余侠客
帖 子:125
专家分:240
注 册:2011-6-4
收藏
得分:0 
哪位大侠可以帮个忙啊!!!!要是不用函数怎么写呢?
这个getwindowtext既不是cwnd里的也不是cedit里的。。。
2011-06-15 23:54
voidx
Rank: 12Rank: 12Rank: 12
来 自:邯郸
等 级:火箭侠
帖 子:1250
专家分:3538
注 册:2011-4-7
收藏
得分:20 
GetWindowText    大写
2011-06-16 00:31
qldxsun
Rank: 4
等 级:业余侠客
帖 子:125
专家分:240
注 册:2011-6-4
收藏
得分:0 
回复 5楼 voidx
没注意。。。谢啦!
2011-06-16 22:23
快速回复:求助!获取编辑框里输入的字符串
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015249 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved