CListBox::GetCurSel
int GetCurSel( ) const;Return ValueThe zero-based index of the currently selected item. It is LB_ERR if no item is currently selected or if the list box is a multiple-selection list box.ResRetrieves the zero-based index of the currently selected item, if any, in a single-selection list box. GetCurSel should not be called for a multiple-selection list box.Example// The pointer to my list box.
extern CListBox* pmyListBox;// Select the next item of the currently selected one.
int nIndex = pmyListBox->GetCurSel();
int nCount = pmyListBox->GetCount();
if ((nIndex != LB_ERR) && (nCount > 1))
{
if (++nIndex < nCount)
pmyListBox->SetCurSel(nIndex);
else
pmyListBox->SetCurSel(0);
}
int GetCurSel( ) const;Return ValueThe zero-based index of the currently selected item. It is LB_ERR if no item is currently selected or if the list box is a multiple-selection list box.ResRetrieves the zero-based index of the currently selected item, if any, in a single-selection list box. GetCurSel should not be called for a multiple-selection list box.Example// The pointer to my list box.
extern CListBox* pmyListBox;// Select the next item of the currently selected one.
int nIndex = pmyListBox->GetCurSel();
int nCount = pmyListBox->GetCount();
if ((nIndex != LB_ERR) && (nCount > 1))
{
if (++nIndex < nCount)
pmyListBox->SetCurSel(nIndex);
else
pmyListBox->SetCurSel(0);
}
解决方案 »
- 基于对话框的应用程序问题
- 如何把400多张图片做成资源DLL,然后通过他的名字或路径调用他
- 路径问题,被../和..\\还有.\搞糊涂了
- 这个钩子怎么卸下后就装不上了
- 要求可以实现wpe的功能,截取一个进程的socket模拟发送,接收等.价格您说!
- 如何加快大文件复制的速度?多线程复制方式是否可取?
- 我想问问怎么做好的程序(MFC)在自已的机上可以运行.到别人机上就不行了.
- Link error:请大家帮忙看看
- 如何在一个位图背景上绘制图形,并且视图窗口大小改变、出现对话框覆盖视图窗口等等情况下,绘制的图形不会消失?
- 如何查看界面
- 有关objectarx
- New Question to XT2(),
AddString
InsertString
查一下MSDN