VC中,LVITEM结构中的LPARAM lParam成员该怎么用?

来源:百度知道 编辑:UC知道 时间:2024/05/07 13:59:18
我想用LPARAM lParam成员来储存其他的数据。
这个数据是一个指针吗?
这个数据该怎么赋值?
该怎么把这个数据再赋值回来?
这个成员只能储存数据不能把数据赋值回来了吗?

MSDN:
lParam
Value specific to the item. If you use the LVM_SORTITEMS message, the list-view control passes this value to the application-defined comparison function. You can also use the LVM_FINDITEM message to search a list-view control for an item with a specified lParam value.

lParam是item的一个标识,被保留用作LVM_SORTITEMS和LVM_FINDITEM消息的参数,如果你需要用到排列和查找item的话就必须保留这个变量,否则你可以把你想存储的数据的指针强行转换成LPARAM后赋给它,要再赋回来的话只能另外再添加一个变量存储原先的值了。