CListBox::GetItemDataPtr

更新 : 2007 年 11 月

指定したリスト ボックス項目に関連付けられているアプリケーション指定の 32 ビット値をポインタ (void*) として取得します。

void* GetItemDataPtr(
   int nIndex 
) const;

パラメータ

  • nIndex
    リスト ボックスの項目を 0 から始まるインデックスで指定します。

戻り値

ポインタを返します。エラーが発生した場合は、-1 を返します。

使用例

LPVOID lpmyPtr = pParentWnd;

// Check all the items in the list box; if an item's
// data pointer is equal to my pointer then reset it to NULL.
for (int i=0; i < m_myListBox.GetCount(); i++)
{
   if (m_myListBox.GetItemDataPtr(i) == lpmyPtr)
   {
      m_myListBox.SetItemDataPtr(i, NULL);
   }
}

必要条件

ヘッダー : afxwin.h

参照

参照

CListBox クラス

階層図

CListBox::AddString

CListBox::GetItemData

CListBox::InsertString

CListBox::SetItemData

LB_GETITEMDATA

その他の技術情報

CListBox のメンバ