我用GetWindowsText()方法,发现有的值正确,有的值不正确。另外,我用的是AddString()方法,所以使用GetCursel()方法虽然能得到当前所选的索引号,但和字符串没有对应关系,用什么方法能得到我选中的字符串呢?请大家帮忙,另外,本人积分不多了,只能给三十分,请体谅。
解决方案 »
- 关于Ribbon界面右键菜单问题
- CStringArray 和 CStringList到底有什么区别啊?
- 如何取得文件版本信息?
- 高难问题:如何在资源管理器里虚拟一个驱动器出来?像GMail Driver一样的
- 字符串变成日期的咒语是~~~
- 有哪位能不能给我提供一个简单的用ODBC的数据库的例子?在线等待
- 谁能给我一个c++入门教程的下载地址?谢谢了~~
- 关于向DLL传入变量的问题(对不起,我没分了,谢谢各位)
- 求助!怎么在vs2008设置并使用ImageMagick,运行程序出现了下面的错误!!!
- 如何在vc中打开matlab进行图像处理
- 怎样使用soap?
- 如何能取得到用 InstallShield 安装时用户设定的安装目录?
This method retrieves a string from the list box of a combo box. The overloaded form of this method fills a CString object with the text of the item.int GetLBText(
int nIndex,
LPTSTR lpszText )
const; void GetLBText(
int nIndex,
CString& rString )
const;
Parameters
nIndex
Contains the zero-based index of the list box string to copy.
lpszText
Pointer to a buffer that is to receive the string. The buffer must have sufficient space for the string and a terminating null character.
rString
A reference to a CString.
Return Value
The length, in bytes, of the string, excluding the terminating null character. If nIndex does not specify a valid index, the return value is CB_ERR.Example
// The pointer to a combo box.
extern CComboBox* pmyComboBox;// Dump the items in the combo box.
#ifdef _DEBUG
CString str, str2;
int n;
for (int i=0;i < pmyComboBox->GetCount();i++)
{
n = pmyComboBox->GetLBTextLen( i );
pmyComboBox->GetLBText( i, str.GetBuffer(n) );
str.ReleaseBuffer(); str2.Format(_T("item %d: %s\r\n"), i, str.GetBuffer(0));
afxDump << str2;
}
#endifRequirements
Windows CE versions: 1.0 and later
Header file: Declared in Afxwin.h
Platform: H/PC Pro, Palm-size PC, Pocket PCSee Also
CComboBox::GetLBTextLen