G
Guy Lateur
Hi all,
I'm trying to generate a (exhaustive) list of all the applications that are
installed on a user's machine. I've written some code that reads the
registry ('App Paths'):
<code>
appKey = win32api.RegOpenKeyEx(win32con.HKEY_LOCAL_MACHINE,
'SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths', 0, win32con.KEY_READ)
sklist = win32api.RegEnumKeyEx(appKey)
for skey in sklist:
print skey[0]
try:
wPath = win32api.RegQueryValue(appKey, skey[0])
print ' ' + wPath
except pywintypes.error,details:
print '### Error [pywintypes.error]: ' + details[2]
win32api.RegCloseKey(appKey)
</code>
This works, but I was wondering wether that is the best way to go about
this? Can I be sure it lists *all* the applications? What does it mean when
a pywintypes.error is thrown (code 13, 'Invalid data')?
Thanks,
g
I'm trying to generate a (exhaustive) list of all the applications that are
installed on a user's machine. I've written some code that reads the
registry ('App Paths'):
<code>
appKey = win32api.RegOpenKeyEx(win32con.HKEY_LOCAL_MACHINE,
'SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths', 0, win32con.KEY_READ)
sklist = win32api.RegEnumKeyEx(appKey)
for skey in sklist:
print skey[0]
try:
wPath = win32api.RegQueryValue(appKey, skey[0])
print ' ' + wPath
except pywintypes.error,details:
print '### Error [pywintypes.error]: ' + details[2]
win32api.RegCloseKey(appKey)
</code>
This works, but I was wondering wether that is the best way to go about
this? Can I be sure it lists *all* the applications? What does it mean when
a pywintypes.error is thrown (code 13, 'Invalid data')?
Thanks,
g