Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleDisplay the Microsoft System Information application
DescriptionThis example shows how to display the Microsoft System Information application in Visual Basic 6. It finds the application's path in the Registry and uses Shell to run it.
Keywordssystem information
CategoriesSoftware Engineering, Windows
 
When it starts, the program looks in the Registry for the HKEY_LOCAL_MACHINE\software\microsoft\shared tools\msinfo key and gets its Path value. It then uses Shell to launch the program.
 
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
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated