Starting with the Windows Vista PlatformSDK, defining the symbol STRICT_TYPED_ITEMIDS before including shell header files changes declarations that previously had simply used ITEMIDLIST now use one of various types which are more clear about what type of ID list is being used.
Think of it as the STRICT macro for the shell.
The more precise names emphasize the form of the ID list:
ITEMID_CHILDrepresents an item ID relative to some implied shell folder. The item ID is followed by a null terminator and is therefore exactly oneSHITEMIDlong. In file-system speak, this is a “file name.”IDLIST_RELATIVErepresents an item ID list relative to some implied shell folder. It can consist of any number ofSHITEMIDstructures concatenated together, followed by a null terminator. This item ID list must be used in conjunction with theIShellFolderit is associated with. In file-system speak, this is a “relative path.”IDLIST_ABSOLUTErepresents an item ID list relative to the desktop root folder. It too can be any length. This item ID list must be used in conjunction with theIShellFolderreturned bySHGetDesktopFolder. In file-system speak, this is a “fully-qualified absolute path.” (An absolute ID list is the special case of a relative ID list where the implied shell folder is the desktop root folder.)ITEMID_CHILD_ARRAYrepresents an array of pointers toITEMID_CHILDobjects, where all of theITEMID_CHILDobjects are children of the same shell folder parent. The array must be used in conjunction with that parent shell folder.
These new types were introduced to help catch common programming errors when using the shell namespace. For example, if you try to pass an array of absolute pidls to IShellFolder::GetUIObjectOf, you will get a type mismatch compiler error because that method takes an ITEMID_CHILD_ARRAY, and the thing you passed is not an array of ITEMID_CHLD pointers.
You are encouraged to turn on strict mode when compiling code that uses the shell namespace, but to preserve source code backward compatibility, the setting is off by default.
0 comments