A wrapper class for ITEMIDLIST
CItemIDList class helps manage ITEMIDLIST more easily
Introduction
This is a class helps you manage ITEMIDLIST
easier.
The
CItemIDList
class holds a pointer to a ITEMIDLIST
structure
(the pointer is in CItemIDList::m_pidl
). It also has public static
member functions which you can use as global functions.(Version 2.0)
Constructors
|
Construct with a path string. |
|
Construct with |
|
Construct with another class object. |
|
Construct class instance with |
Member functions
|
Get folder item's icon index in system image list. |
|
Retrieve pidl's dislpay name. |
|
Copy a pidl due to the count number. |
|
Whether |
|
Return a relative pidl at specified index. |
|
Create from a |
|
Get pidl count. |
|
Get pidl's size,in byte. |
|
Free |
|
Retrieve full path.(only available for full-quality pidl) |
|
Retrieve other shell interface.Same as IShellFolder::GetUIObjectOf. |
|
Get IShellFolder interface and the tail pidl cell from a full-quality pidl. |
|
Retrieve the tail pidl cell. |
|
Retrieve the tooltip info of the m_pidl. |
|
Attach a pidl. |
|
Detach a pidl. |
Operators
|
Concat two pidls. |
|
Get |
|
Get |
|
Copy from another class instance. |
|
Copy from a |
|
Add a new pidl to |
|
Query whether two pidl's name is same. |
|
Return a relative pidl at specified index.(Same as |
Example
#include "ItemIDList.h" #include <windows.h> #include <iostream.h> //Some test code... void main() { char szFile[MAX_PATH]; ZeroMemory(szFile,MAX_PATH); OPENFILENAME info; ZeroMemory(&info,sizeof(info)); info.lStructSize=sizeof(info); info.lpstrFile=szFile; info.hwndOwner=NULL; info.nMaxFile=MAX_PATH; if(GetOpenFileName(&info)) { CItemIDList item(szFile),item2; char szName[MAX_PATH]; item.GetDisplayName(szName); cout<<szName<<endl; item.GetToolTipInfo(szName,MAX_PATH); cout<<szName<<endl; item2=item; item2.GetPath(szName); cout<<szName<<endl; item2=item[item.GetCount()-1]; item2.GetDisplayName(szName); cout<<szName<<endl; item2=item.GetAt(0); item2.GetDisplayName(szName); cout<<szName<<endl; CItemIDList item3; item3=item.Duplicate(item.GetCount()-1); item3.GetPath(szName); cout<<szName<<endl; item3=item.Duplicate(item.GetCount()-1)+item2; item3.GetPath(szName); cout<<szName<<endl; } }
Enjoy...