本文整理匯總了Python中win32com.shell.shellcon.CSIDL_DESKTOP屬性的典型用法代碼示例。如果您正苦於以下問題:Python shellcon.CSIDL_DESKTOP屬性的具體用法?Python shellcon.CSIDL_DESKTOP怎麽用?Python shellcon.CSIDL_DESKTOP使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類win32com.shell.shellcon
的用法示例。
在下文中一共展示了shellcon.CSIDL_DESKTOP屬性的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: ExplorePIDL
# 需要導入模塊: from win32com.shell import shellcon [as 別名]
# 或者: from win32com.shell.shellcon import CSIDL_DESKTOP [as 別名]
def ExplorePIDL():
pidl = shell.SHGetSpecialFolderLocation(0, shellcon.CSIDL_DESKTOP)
print "The desktop is at", shell.SHGetPathFromIDList(pidl)
shell.ShellExecuteEx(fMask=shellcon.SEE_MASK_NOCLOSEPROCESS,
nShow=win32con.SW_NORMAL,
lpClass="folder",
lpVerb="explore",
lpIDList=pidl)
print "Done!"
示例2: test_idlist_roundtrip
# 需要導入模塊: from win32com.shell import shellcon [as 別名]
# 或者: from win32com.shell.shellcon import CSIDL_DESKTOP [as 別名]
def test_idlist_roundtrip(self):
pidl = shell.SHGetSpecialFolderLocation(0, shellcon.CSIDL_DESKTOP)
item = shell.SHCreateItemFromIDList(pidl, shell.IID_IShellItem)
pidl_back = shell.SHGetIDListFromObject(item)
self.assertEqual(pidl, pidl_back)
示例3: test_parsing_relative
# 需要導入模塊: from win32com.shell import shellcon [as 別名]
# 或者: from win32com.shell.shellcon import CSIDL_DESKTOP [as 別名]
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))
示例4: test_create_item_with_parent
# 需要導入模塊: from win32com.shell import shellcon [as 別名]
# 或者: from win32com.shell.shellcon import CSIDL_DESKTOP [as 別名]
def test_create_item_with_parent(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()
item1 = shell.SHCreateItemWithParent(desktop_pidl, None, child_pidl, shell.IID_IShellItem)
item2 = shell.SHCreateItemWithParent(None, sf, child_pidl, shell.IID_IShellItem)
self.assertShellItemsEqual(item1, item2)
示例5: get_desktop
# 需要導入模塊: from win32com.shell import shellcon [as 別名]
# 或者: from win32com.shell.shellcon import CSIDL_DESKTOP [as 別名]
def get_desktop():
'''Return user Desktop folder'''
return shell.SHGetFolderPath(0, shellcon.CSIDL_DESKTOP, None, 0)