上传CADVer函数供大家讨论 Public Const HKEY_CURRENT_USER = &H80000001 Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As Long
Public Function cadVer() As String '返回AutoCAD的版本号 Dim hKey As Long, ret As Long, lenData As Long, typeData As Long Dim Name As String, s As String ret = RegOpenKey(HKEY_CURRENT_USER, "Software\Autodesk\AutoCAD", hKey) If ret <> 0 Then MsgBox "AutoCAD程序安装不正确" Exit Function End If Name = "CurVer" ret = RegQueryValueEx(hKey, Name, 0, typeData, ByVal vbNullString, lenData) s = String(lenData, Chr(0)) ret = RegQueryValueEx(hKey, Name, 0, typeData, ByVal s, lenData) cadVer = Left(s, InStr(s, Chr(0)) - 1) RegCloseKey hKey End Function
[em08][em10] |