在vb中怎樣才可能知道有沒有安裝powerpoint,和安裝了什么版本???????救命!

解决方案 »

  1.   

    读powerpoint在数据库中的安装键值。
      

  2.   

    在注冊表是可以讀出office的安裝情況,但這不一定能夠說明
    powerpoint的安裝與否啊?
    大俠!還有什么解決方法!
    多謝!
      

  3.   

    以下代码能够找出一个文件的关联文件,在本机上,下述代码返回:D:\Program Files\Microsoft Office\Office\WINWORD.EXE。对于楼主的需求,这足够了。Option Explicit
    '’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’
    ' Copyright ?1996-2004 VBnet, Randy Birch, All Rights Reserved.
    ' Some pages may also contain other copyrights by the author.
    '’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’
    ' Distribution: You can freely use this code in your own
    '               applications, but you may not reproduce
    '               or publish this code on any web site,
    '               online service, or distribute as source
    '               on any media without express permission.
    '’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’
    Private Declare Function FindExecutable Lib "shell32" _
       Alias "FindExecutableA" _
      (ByVal lpFile As String, _
       ByVal lpDirectory As String, _
       ByVal sResult As String) As LongPrivate Const MAX_PATH As Long = 260
    Private Const ERROR_FILE_NO_ASSOCIATION As Long = 31
    Private Const ERROR_FILE_NOT_FOUND As Long = 2
    Private Const ERROR_PATH_NOT_FOUND As Long = 3
    Private Const ERROR_FILE_SUCCESS As Long = 32 'my constant
    Private Const ERROR_BAD_FORMAT As Long = 11Private Sub Command1_Click()   Dim success As Long
       Dim pos As Long
       Dim sResult As String
       Dim msg As String
       
       sResult = Space$(MAX_PATH)  'lpFile: name of the file of interest
      'lpDirectory: location of lpFile
      'sResult: path and name of executable associated with lpFile
       success = FindExecutable("040301修改意见.doc", "E:\My program\DHtj\", sResult)
          
       Select Case success
          Case ERROR_FILE_NO_ASSOCIATION: msg = "no association"
          Case ERROR_FILE_NOT_FOUND: msg = "file not found"
          Case ERROR_PATH_NOT_FOUND: msg = "path not found"
          Case ERROR_BAD_FORMAT:     msg = "bad format"
          
          Case Is >= ERROR_FILE_SUCCESS:
             
             pos = InStr(sResult, Chr$(0))
             
             If pos Then
                msg = Left$(sResult, pos - 1)
             End If
             
       End Select
       
       MsgBox msg
       
    End Sub
    '--end block--’
      

  4.   

    另一种办法就是读注册表:
    以doc为例
    1)在HKEY_CLASSES_ROOT中查找扩展名.doc找到HKEY_CLASSES_ROOT\.doc,取其默认值Word.Document.82)在HKEY_CLASSES_ROOT中查找Word.Document.8
    找到HKEY_CLASSES_ROOT\Word.Document.8\shell\Open\command\,其默认值就是程序路径如果找不到,自然就没安装了。