def test_parsing_relative(self):
desktop_pidl = shell.SHGetSpecialFolderLocation(0, shellcon.CSIDL_DESKTOP)
desktop_item = shell.SHCreateItemFromIDList(desktop_pidl, shell.IID_IShellItem)
sf = shell.SHGetDesktopFolder()
flags = shellcon.SHCONTF_FOLDERS | shellcon.SHCONTF_NONFOLDERS
children = sf.EnumObjects(0, flags)
child_pidl = children.next()
name_flags = shellcon.SHGDN_FORPARSING | shellcon.SHGDN_INFOLDER
name = sf.GetDisplayNameOf(child_pidl, name_flags)
item = shell.SHCreateItemFromRelativeName(desktop_item, name, None,
shell.IID_IShellItem)
# test the name we get from the item is the same as from the folder.
self.assertEqual(name, item.GetDisplayName(name_flags))
评论列表
文章目录