我想用读注册表的方法找到AutoCAD R14的安装路径,但不知如何处理?

解决方案 »

  1.   

    Const MAX_FILENAME_LEN = 260
    Private Declare Function FindExecutable Lib "shell32.dll" Alias "FindExecutableA" (ByVal lpFile As String, ByVal lpDirectory As String, ByVal lpResult As String) As Long
    Private Sub Form_Click()
       Dim I As Integer, s2 As String
       dim AutoCADPath as String
       Const MyCADFile = "F:\temp2\try.CAD"   s2 = String(MAX_FILENAME_LEN, 32)
       I = FindExecutable(MyCADFile, vbNullString, s2)
       If I > 32 Then
          AutoCADPath=Left$(s2, InStr(s2, Chr$(0)) - 1)
          msgbox AutoCADPath '报告AutoCAD.exe程序的路径
          shell AutoCADPath '运行AutoCAD.exe
       Else
          MsgBox "没找到AutoCAD程序!"
       End If
    End Sub
      

  2.   

    可事先在自己程序目录下建立一个CAD文件,然后用上面的代码找运行这个CAD文件的程序(即AutoCAD.exe)所在的路径。
    上一次那个满足不了你的需要,希望这一次能满足你的需求于:D
      

  3.   

    读取注册表的方法——研究ing
      

  4.   

    读取注册表的方法,参考:
    http://search.csdn.net/expert/topic/51/5101/2002/7/19/886226.htm
      

  5.   

    [HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\要找的程序项目名称]"UninstallString"="....""   '路径
      

  6.   

    [HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\要找的程序项目名称]"UninstallString"="....""   '路径
    这个方法很多不能成功 :D有的UninstallString指向的是系统目录的一个文件,有的更是“rundll32.exe……”
    噢,越来越高深~!~¥#¥!