谢谢楼上3位,我可能没说清楚。网上我看到有人这样用的。这个是msdn中的一个宏。 ListView_GetSubItemRectBOOL ListView_GetSubItemRect( HWND hwndLV, int iItem, int iSubItem, int code, LPRECT lpRect );Retrieves information about the rectangle that surrounds a subitem in a list view control. You can use this macro (recommended) or send the LVM_GETSUBITEMRECT message explicitly. This macro is intended to be used only on list view controls that use the LVS_REPORT style. Returns nonzero if successful, or zero otherwise. hwndLV Handle to a list view control. iItem Index of the subitem's parent item. iSubItem The one-based index of the subitem. code Portion of the list view subitem for which to retrieve the bounding rectangle information. This value can be one of the following: LVIR_BOUNDS Returns the bounding rectangle of the entire item, including the icon and label. LVIR_ICON Returns the bounding rectangle of the icon or small icon. LVIR_LABEL Returns the bounding rectangle of the entire item, including the icon and label. This is identical to LVIR_BOUNDS. lpRect Address of aRECT structure that receives the subitem bounding rectangle information. Version 4.70
2) 自定义非窗体类函数,在窗体类外声明。
所以告诉你它没有被声明。
ListView_GetSubItemRectBOOL ListView_GetSubItemRect(
HWND hwndLV,
int iItem,
int iSubItem,
int code,
LPRECT lpRect
);Retrieves information about the rectangle that surrounds a subitem in a list view control. You can use this macro (recommended) or send the LVM_GETSUBITEMRECT message explicitly. This macro is intended to be used only on list view controls that use the LVS_REPORT style. Returns nonzero if successful, or zero otherwise.
hwndLV
Handle to a list view control.
iItem
Index of the subitem's parent item.
iSubItem
The one-based index of the subitem.
code
Portion of the list view subitem for which to retrieve the bounding rectangle information. This value can be one of the following: LVIR_BOUNDS Returns the bounding rectangle of the entire item, including the icon and label.
LVIR_ICON Returns the bounding rectangle of the icon or small icon.
LVIR_LABEL Returns the bounding rectangle of the entire item, including the icon and label. This is identical to LVIR_BOUNDS. lpRect
Address of aRECT structure that receives the subitem bounding rectangle information.
Version 4.70
CommCtrl;CommCtrl是TListView与TTreeView的基本库。
ListView来自哪个unit要写好,像7楼就告诉你了,否则识别不了
在使用TListView的方法,如果是类方法,就不需要对象引用,直接类调用就行,否则就得对象引用