#include <Array.au3>
#include <WinAPIEx.au3>
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
Opt('MustDeclareVars', 1)
_Main()
Func _Main()
Local $iI, $iTimer, $hListView
; 创建界面
GUICreate("ListView Add Array", 500, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 460, 268)
_GUICtrlListView_SetUnicodeFormat($hListView, False)
GUISetState()
; 添加列
_GUICtrlListView_AddColumn($hListView, "键名", 100)
_GUICtrlListView_AddColumn($hListView, "软件名", 100)
_GUICtrlListView_AddColumn($hListView, "安装路径", 100)
_GUICtrlListView_AddColumn($hListView, "卸载文件名", 100)
Global $hKey, $Count, $Num = 1
$hKey = _WinAPI_RegOpenKey($HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall')
If @error Then
MsgBox(0, 0, "未安装.NETFramework")
Exit
Else
$Count = _WinAPI_RegQueryInfoKey($hKey)
_GUICtrlListView_SetItemCount($hListView, $Count[0])
Dim $reg_array[$Count[0]][4]
For $i = 0 To UBound($reg_array) - 1
$reg_array[$i][0] = _WinAPI_RegEnumKey($hKey, $i)
$reg_array[$i][1] = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" & $reg_array[$i][0], "DisplayName")
$reg_array[$i][2] = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" & $reg_array[$i][0], "InstallDir")
$reg_array[$i][3] = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" & $reg_array[$i][0], "UninstallString")
Next
_WinAPI_RegCloseKey($hKey)
;_ArrayDisplay($reg_array)
EndIf
_GUICtrlListView_AddArray($hListView, $reg_array)
; 循环至用户退出
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main
|