最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
使用API函数修改注册表
时间:2022-07-02 12:10:49 编辑:袖梨 来源:一聚教程网
使用API函数修改注册表
为了让自己的程序成为自动启动需要修改注册表。下面事例可以供参考
Option Explicit
Const REG_SZ = 1
Global Const HKEY_LOCAL_MACHINE = &H80000002
Public Declare Function RegOpenKey Lib "advapi32" Alias "RegOpenKeyA" _
(ByVal hKey As Long, ByVal lpszSubKey As String, phkResult As Long) As Long
'该函数用于打开系统注册表中已存在的键函数的返回值:键打开成功返回0,否则返回非0,phkResult被设置为该键的句柄。
Public Declare Function RegSetValueEx Lib "advapi32" Alias "RegSetValueExA" _
(ByVal hKey As Long, ByVal lpszValueName As String, _
ByVal dwReserved As Long, ByVal fdwType As Long, _
lpbData As Any, ByVal cbData As Long) As Long
'该函数用于向系统注册表中指定的键添加键名和键值。函数的返回值: 添加键名、键值成功返回0,否则返回非0。
Public Declare Function RegCloseKey Lib "advapi32" (ByVal hKey As Long) As Long
'该函数用于关闭系统注册表中打开的键。函数的返回值:键关闭成功返回0,否则返回非0。
Public Declare Function RegDeleteValue Lib "advapi32.dll" Alias "RegDeleteValueA" _
(ByVal hKey As Long, ByVal lpValueName As String) As Long
'该函数用于删除注册表中打开键的键值
Public Declare Function RegDeleteKey Lib "advapi32.dll" Alias "RegDeleteKeyA" _
(ByVal hKey As Long, ByVal lpSubKey As String) As Long
相关文章
- 《原神》5.2卡池抽取建议 11-14
- 《原神》5.2版本新怪物介绍 11-14
- 《原神》希诺宁增伤触发方法 11-14
- 《原神》循音觅奇活动入口 11-14
- 《原神》循音觅奇兑换码获取方法 11-14
- 《原神》花羽会活动飞行技巧介绍 11-14