| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2793 人关注过本帖
标题:[求助] SetDlgItemText问题
只看楼主 加入收藏
zbt123456
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2006-8-17
收藏
 问题点数:0 回复次数:2 
[求助] SetDlgItemText问题
大家好:
刚刚上路的新手,请大家多多关照!!
我有个问题,请问用SetDlgItemText时,如何不覆盖原来的内容!!
谢谢大家
搜索更多相关主题的帖子: 如何 
2006-08-17 11:27
十一月天
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:10
帖 子:3030
专家分:0
注 册:2006-4-19
收藏
得分:0 

SetDlgItemText Function

--------------------------------------------------------------------------------

The SetDlgItemText function sets the title or text of a control in a dialog box.

Syntax

BOOL SetDlgItemText( HWND hDlg,
int nIDDlgItem,
LPCTSTR lpString
);
Parameters

hDlg
[in] Handle to the dialog box that contains the control.
nIDDlgItem
[in] Specifies the control with a title or text to be set.
lpString
[in] Pointer to the null-terminated string that contains the text to be copied to the control.
Return Value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.


Remarks

The SetDlgItemText function sends a WM_SETTEXT message to the specified control.

Windows 95/98/Me: SetDlgItemTextW is supported by the Microsoft® Layer for Unicode (MSLU). To use this, you must add certain files to your application, as outlined in Microsoft Layer for Unicode on Windows 95/98/Me Systems.

Example

For an example, see Creating a Simple List Box.

Function Information

Header Declared in Winuser.h, include Windows.h
Import library User32.lib
Minimum operating systems Windows 95, Windows NT 3.1
Unicode Implemented as Unicode and ANSI versions on Windows NT, Windows 2000, Windows XP


当头晕的时候我终于明白了什么叫爱情。
2006-08-17 13:35
niewucai
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2006-7-22
收藏
得分:0 
回复:(zbt123456)[求助] SetDlgItemText问题

假如你要输入数据的 编辑框 的ID为IDC_EDIT1,你可以先在头文件里定义一个实例
CEdit m_edit;
然后再在
void CMyDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX,IDC_EDIT1,m_edit);//加入这一行
}
就可以用
ReplaceSel(字符串);
UpdateData(TRUE);
就不会覆盖原来的内容了。

2007-03-10 12:22
快速回复:[求助] SetDlgItemText问题
数据加载中...
 
   



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

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