[pywin32-checkins] pywin32/com/win32comext/shell/test testShellFolder.py,1.1,1.2
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: <mha...@us...> - 2003-10-31 06:58:52
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/shell/test In directory sc8-pr-cvs1:/tmp/cvs-serv17868 Modified Files: testShellFolder.py Log Message: Demonstrate/test PyIShellFolder's __iter__. Index: testShellFolder.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/test/testShellFolder.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** testShellFolder.py 8 Oct 2003 05:47:57 -0000 1.1 --- testShellFolder.py 31 Oct 2003 06:58:48 -0000 1.2 *************** *** 3,11 **** sf = shell.SHGetDesktopFolder() ! print "sf is", sf enum = sf.EnumObjects(0, SHCONTF_FOLDERS | SHCONTF_NONFOLDERS | SHCONTF_INCLUDEHIDDEN) ! print "enum is", enum for i in enum: ! name = sf.GetDisplayNameOf(i, SHGDN_NORMAL) print name - --- 3,21 ---- 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 |