检查注册表里面有没有相应的键值,给你个检测是否安装了excel的例子Public Const HKEY_LOCAL_MACHINE As Long = &H80000002 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 Dim lRet As Long, hKey As Long lRet = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Office\11.0\Excel", hKey)
If lRet <> 0 Then 'no excel instralled Else 'excel installed lRet = RegCloseKey(hKey) End IfMatlab的键值你找台安装过的打开注册表看看就知道了另外一种方法就是,你创建matlab对象,如果出错就说明机器上没有安装
Function install(ByVal exefilename As String) As String On Error GoTo myerr Dim WSH As Object Set WSH = CreateObject("Wscript.Shell") install = "<" & exefilename & "> was installed in " & WSH.RegRead("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\App Paths\" & exepath & "\Path") Set WSH = Nothing Exit Function myerr: install = "<" & exefilename & "> was Not installed in my system" End FunctionSub xxx() MsgBox install("matlab.exe") End Sub
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
Dim lRet As Long, hKey As Long
lRet = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Office\11.0\Excel", hKey)
If lRet <> 0 Then
'no excel instralled
Else
'excel installed
lRet = RegCloseKey(hKey)
End IfMatlab的键值你找台安装过的打开注册表看看就知道了另外一种方法就是,你创建matlab对象,如果出错就说明机器上没有安装
On Error GoTo myerr
Dim WSH As Object
Set WSH = CreateObject("Wscript.Shell")
install = "<" & exefilename & "> was installed in " & WSH.RegRead("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\App Paths\" & exepath & "\Path")
Set WSH = Nothing
Exit Function
myerr:
install = "<" & exefilename & "> was Not installed in my system"
End FunctionSub xxx()
MsgBox install("matlab.exe")
End Sub
2 查看注册表HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall有无那个程序的反安装项
3 查看开始菜单的相关项