Howdy.
Just wondering is the list of programs installed on the $current$ computer always listed here :
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall
And if so, is there a way of enumerating through that list of crap ?
Printable View
Howdy.
Just wondering is the list of programs installed on the $current$ computer always listed here :
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall
And if so, is there a way of enumerating through that list of crap ?
It looks like it is, and you can gt the names using this code...
In a module...
Usage: (Don't forget the listbox!)VB Code:
Public Const HKEY_CLASSES_ROOT = &H80000000 Public Const HKEY_CURRENT_USER = &H80000001 Public Const HKEY_LOCAL_MACHINE = &H80000002 Public Const HKEY_USERS = &H80000003 Public Const HKEY_PERFORMANCE_DATA = &H80000004 Public Const HKEY_CURRENT_CONFIG = &H80000005 Public Const HKEY_DYN_DATA = &H80000006 Public Const REG_SZ = 1 ' Unicode nul terminated string Public Const REG_BINARY = 3 ' Free form binary Public Const REG_DWORD = 4 ' 32-bit number Public Const ERROR_SUCCESS = 0& Public Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long Public Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long Public Declare Function RegEnumKey Lib "advapi32.dll" Alias "RegEnumKeyA" (ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpName As String, ByVal cbName As Long) As Long Public Declare Function RegEnumValue Lib "advapi32.dll" Alias "RegEnumValueA" (ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpValueName As String, lpcbValueName As Long, lpReserved As Long, lpType As Long, lpData As Byte, lpcbData As Long) As Long Public Function GetAllKeys(hKey As Long, strPath As String) As Variant ' Returns: an array in a variant of strings Dim lRegResult As Long Dim lCounter As Long Dim hCurKey As Long Dim strBuffer As String Dim lDataBufferSize As Long Dim strNames() As String Dim intZeroPos As Integer lCounter = 0 lRegResult = RegOpenKey(hKey, strPath, hCurKey) Do 'initialise buffers (longest possible length=255) lDataBufferSize = 255 strBuffer = String(lDataBufferSize, " ") lRegResult = RegEnumKey(hCurKey, lCounter, strBuffer, lDataBufferSize) If lRegResult = ERROR_SUCCESS Then 'tidy up string and save it ReDim Preserve strNames(lCounter) As String intZeroPos = InStr(strBuffer, Chr$(0)) If intZeroPos > 0 Then strNames(UBound(strNames)) = Left$(strBuffer, intZeroPos - 1) Else strNames(UBound(strNames)) = strBuffer End If lCounter = lCounter + 1 Else Exit Do End If Loop GetAllKeys = strNames End FunctionVB Code:
Private Sub Command1_Click() Dim SubKeys As Variant Dim KeyLoop As Integer Dim KeyName As String SubKeys = GetAllKeys(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\Uninstall") If VarType(SubKeys) = vbArray + vbString Then For KeyLoop = 0 To UBound(SubKeys) KeyName = SubKeys(KeyLoop) List1.AddItem KeyName Next End If End Sub
Chris, not looking for a job in Ireland by any chance are you ? ;)
Well the Guiness is better in Ireland apparently...:D
Is there any easy way of accessing the keys contained within each of those folder jobbies returned by that lot above ?
You know that, that is indeed very possible but you'll have to hang for a while cause I have no idea where my old code snippets have gone...
Check your ass, you seem to be sticking everything else there lately ;)
Including that damn brick...man I should never have done that
teeheehee a pile of bricks ...
uhn why do i bother :)