明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1995|回复: 3

AutoCAD2014及以上版本配套采用VBA7.1,关于API的声明方法

[复制链接]
发表于 2018-6-26 20:14:54 | 显示全部楼层 |阅读模式
AutoCAD2014及以上版本配套采用VBA7.1,与以前的VBA6.0版本有一些区别,关于多个CAD版本下的API声明方法如下:

Option Explicit

Option Compare Text
'---------------------------------------------------------------
'- 注册表 API 声明...
'---------------------------------------------------------------
#If VBA7 Then
'  VBA7打开注册表中指定的键
Private Declare PtrSafe Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" _
    (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
' 修注册表中某个键的值
Private Declare PtrSafe Function RegSetValue Lib "advapi32.dll" Alias "RegSetValueA" _
    (ByVal hKey As Long, ByVal lpSubKey As String, ByVal dwType As Long, _
    ByVal lpData As String, ByVal cbData As Long) As Long
' 关闭打开的键
Private Declare PtrSafe Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
#Else
' VBA6打开注册表中指定的键
Private Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" _
    (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
' 修注册表中某个键的值
Private Declare Function RegSetValue Lib "advapi32.dll" Alias "RegSetValueA" _
    (ByVal hKey As Long, ByVal lpSubKey As String, ByVal dwType As Long, _
    ByVal lpData As String, ByVal cbData As Long) As Long
' 关闭打开的键
Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
#End If

Public WithEvents App As AcadApplication


发表于 2018-8-8 13:44:53 | 显示全部楼层
的顶顶顶顶顶多多多多多多多多多
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-28 23:34 , Processed in 0.158120 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表