Get PIDL's of items in GetOpenFileName dialog
I have an implementation of CommonDialog
that allows the user to multi-select files and folders. As long as the Explorer setting 'Hide extensions for known file types' is not checked (checked by default) the class works fine. If it's checked (known extensions are not part of the filename anymore) it doesn't work as I get the selected file and folder names directly (LVM_GETITEMTEXT
)from the listview items.
I've found a MSDN magazine article that describes a solution in C++. The idea is to get the backing PIDL object from the selected items which contain the full filename including the extension 开发者_如何学运维independent of the Explorer settings.
Any idea how to port this to C#?
code to get pidl..
lvitem lvi;
lvi.mask = lvif_param; //0x0004;
lvi.iItem = 1;// the index of item u want to get
sendmessage(listviewhandle,LVM_GETITEM,0,ref lvi);
//Now u can get pidl from lvi.lParam member.
精彩评论