端末にインストールされているアプリケーション名を調べる必要があったので、StdRegProvクラスを使った簡単なマクロを書いてみました。
Option Explicit
Public Sub ListInstalledApplication()
Dim reg As Object
Dim keys As Variant
Dim key As Variant
Dim ret As Long
Dim display_name As String
Const HKEY_LOCAL_MACHINE = &H80000002
Const SubKeyName = "Software\Microsoft\Windows\CurrentVersion\Uninstall\"
Set reg = CreateObject("WbemScripting.SWbemLocator") _
.ConnectServer(, "root\default").Get("StdRegProv")
reg.EnumKey HKEY_LOCAL_MACHINE, SubKeyName, keys
On Error Resume Next
For Each key In keys
display_name = ""
ret = reg.GetStringValue(HKEY_LOCAL_MACHINE, SubKeyName & key, "DisplayName", display_name)
If ret <> 0 Then ret = reg.GetStringValue(HKEY_LOCAL_MACHINE, SubKeyName & key, "QuietDisplayName", display_name)
If (ret = 0) And (Len(Trim(display_name)) > 0) Then
Debug.Print display_name
End If
Next
On Error GoTo 0
End Sub
HKEY_LOCAL_MACHINE\Software\Microsoft
\Windows\CurrentVersion\UninstallにあるキーからDisplayName(QuietDisplayName)を抜き出すだけのシンプルなマクロです。
■ 関連Webページ
・EnumKey method of the StdRegProv class (Windows)
http://msdn.microsoft.com/en-us/library/aa390387.aspx
・Uninstall Registry Key (Windows)
http://msdn.microsoft.com/en-us/library/aa372105.aspx
・コンピューターでアンインストールできるソフトウェア製品を列挙する方法
http://support.microsoft.com/kb/821775/ja
・ITmedia エンタープライズ:Windows Tips「インストールされているアプリケーションの一覧を確認したい」
http://www.itmedia.co.jp/help/tips/windows/w0135.html




















この記事へのコメントはありません。