2007-03-01

找出windows己安裝的軟體

Dim InstalledApp As Object
Dim CurrentApp As Object  
   
 Dim str As String = "Office"  
 Dim GotIT As Boolean  = false
 Try  
     p_objSet = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2").ExecQuery("Select * from Win32_Product")   
     For Each CurrentApp In InstalledApp   
        If CurrentApp.name.ToString.IndexOf(str) >= 0 Then  
            GotIT = True  
            Exit For  
        End If  
     Next  
 Catch e As Exception   
     MessageBox.Show("WMI Exception" & vbcrlf & e.Message)   
 End Try 

沒有留言:

張貼留言