Private SysInfoPath As String
Private Sub Form_Load()
SysInfoPath = FindSysInfoPath
Command1.Enabled = (Len(SysInfoPath) > 0)
End Sub
' Return the path to the Microsoft System
' Information application.
Private Function FindSysInfoPath() As String
Dim buf As String
Dim buf_len As Long
Dim info_key As Long
Dim value_type As Long
Dim key_size As Long
If RegOpenKeyEx(HKEY_LOCAL_MACHINE, _
"software\microsoft\shared tools\msinfo", _
0, KEY_READ, info_key) = ERROR_SUCCESS _
Then
buf = Space$(256)
buf_len = Len(buf)
If RegQueryValueEx(info_key, "Path", _
0, value_type, buf, buf_len) _
= ERROR_SUCCESS _
Then
FindSysInfoPath = Left$(buf, buf_len)
End If
End If
RegCloseKey info_key
End Function
Private Sub Command1_Click()
Shell SysInfoPath, vbNormalFocus
End Sub
|