请教高手:
关于在listbox控件中GetItemData(int)和GetItemDataPtr(int)方法的使用?
GetItemData(int)和GetItemDataPtr(int)方法声明如下:
DWORD GetItemData(int nIndex) const;
void* GetItemDataPtr(int nIndex) const;
DWORD的定义:
typedef unsigned long       DWORD;
我不清楚GetItemData(int)和GetItemDataPtr(int)方法有什么作用,返回的结果怎么使用?
请指教,

解决方案 »

  1.   

    GetItemData地用法:
    用于多选的情况:
    int *pItem;
    int nSelCount;//用户选中的项目总数
    CString strListItem;nSelCount = pListBox->GetSelCount();pItem = new int[nSelCount];
    pListBox->GetSelItems(nSelCount,pItem);//得到被选中项目的索引
    for(i = 0; i < nSelCount; i++)
    {
    pListBox->GetText(pItem[i],strListItem);//得到选中项目的文字
    .......
    }
    delete pItem;//删除索引GetItemDataPtr没用过,不过估计和GetSelItems差不多
      

  2.   

    typedef unsigned long       DWORD;
    什么时候使用这种DWORD类型?