You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ORPA-pyOpenRPA/Resources/WPy64-3720/python-3.7.2.amd64/Lib/site-packages/win32comext/shell/test/testShellFolder.py

22 lines
585 B

from win32com.shell import shell
from win32com.shell.shellcon import *
sf = shell.SHGetDesktopFolder()
print("Shell Folder is", sf)
names = []
for i in sf: # Magically calls EnumObjects
name = sf.GetDisplayNameOf(i, SHGDN_NORMAL)
names.append(name)
# And get the enumerator manually
enum = sf.EnumObjects(0, SHCONTF_FOLDERS | SHCONTF_NONFOLDERS | SHCONTF_INCLUDEHIDDEN)
num = 0
for i in enum:
num += 1
if num != len(names):
print("Should have got the same number of names!?")
print("Found", len(names), "items on the desktop")
for name in names:
print(name)