| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1077 人关注过本帖
标题:求助!获取编辑框字符串
只看楼主 加入收藏
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
百度有个解释,类似的,为什么改成他说的那样就行了?我的这个怎样改???

搜索更多相关主题的帖子: function 字符串 对话框 编辑 
2011-06-15 23:43
a315010225
Rank: 2
等 级:论坛游民
帖 子:64
专家分:10
注 册:2009-10-29
收藏
得分:10 
CString str;
GetDlgItem(IDC_EDIT1)->GetWindowText(str); 你试一下
2011-06-16 17:49
hahayezhe
Rank: 15Rank: 15Rank: 15Rank: 15Rank: 15
来 自:湖南张家界
等 级:贵宾
威 望:24
帖 子:1386
专家分:6999
注 册:2010-3-8
收藏
得分:5 
呵呵 调用完后 记得调用releasebuffer
2011-06-16 21:18
hahayezhe
Rank: 15Rank: 15Rank: 15Rank: 15Rank: 15
来 自:湖南张家界
等 级:贵宾
威 望:24
帖 子:1386
专家分:6999
注 册:2010-3-8
收藏
得分:5 
代码没有错 Window要大写 后面要加
str.releasebuffer
2011-06-16 21:19
qldxsun
Rank: 4
等 级:业余侠客
帖 子:125
专家分:240
注 册:2011-6-4
收藏
得分:0 
GetDlgItem(IDC_EDIT1)->GetWindowText(str);
写的时候没注意!谢谢大家!
2011-06-16 22:46
qldxsun
Rank: 4
等 级:业余侠客
帖 子:125
专家分:240
注 册:2011-6-4
收藏
得分:0 
回复 4楼 hahayezhe
没有调用str.GetBuffer();也要release吗?
2011-06-16 22:50
快速回复:求助!获取编辑框字符串
数据加载中...
 
   



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

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