是这样的,我想获取列表中被选择项的CListItem*然后传入一个函数里面进行运算,但是我不知道怎么获得 有没有什么函数可以获取,我只知道GetCurSel()是获取被选中项的下标。 列表是单选的。

解决方案 »

  1.   

    //是不是?
    typedef struct _LVITEM { 
        UINT   mask; 
        int    iItem; 
        int    iSubItem; 
        UINT   state; 
        UINT   stateMask; 
        LPTSTR  pszText; 
        int    cchTextMax; 
        int    iImage; 
        LPARAM lParam;
    #if (_WIN32_IE >= 0x0300)
        int iIndent;
    #endif
    } LVITEM, FAR *LPLVITEM; 
    //
    CListCtrl::GetItem
    BOOL GetItem( LVITEM* pItem ) const;
      

  2.   

    什么叫被选项的CListItem*
    你用的是ListCtrl还是ListBox
    你说的事他们的Item?
    通过GetItem?
      

  3.   

    噢,我看错了CListItem* 是一个类的指针,用来获取句柄的
      

  4.   

    我用的是listbox,想获取被选中的那一条的句柄
      

  5.   

    listbox的Item好像还真没有句柄
    看看GetItemDataPtr是不是你需要的
      

  6.   

    是不是要用:
    CListBox::GetItemDataPtr 
    void* GetItemDataPtr( int nIndex ) const;Return ValueRetrieves a pointer, or –1 if an error occurs.ParametersnIndexSpecifies the zero-based index of the item in the list box.ResRetrieves the application-supplied 32-bit value associated with the specified list-box item as a pointer (void*).?