| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1694 人关注过本帖
标题:Help VB 运行时错误'453':
只看楼主 加入收藏
bccnzhou
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2022-2-8
结帖率:100%
收藏
已结贴  问题点数:10 回复次数:5 
Help VB 运行时错误'453':
我的系统是Microsoft Windows [版本 10.0.19042.1165]
VB6企业版
图片附件: 游客没有浏览图片的权限,请 登录注册

运行时错误'453':
不能找到入口点 RegCloseKeyA在advapi32.dll
程序奉上:
Reg.rar (2.69 KB)

Advapi32.dll 我在WIN10system32下和Wow64下都找到,但还是报错,不过程序执行成功了
图片附件: 游客没有浏览图片的权限,请 登录注册

请问要下载哪个版本的Advapi32.dll呢?还有就是Advapi32.dll 属于哪个控件,可以直接勾选使用吗
程序代码:
Option Explicit
Private Const HKEY_CLASSES_ROOT = &H80000000
Private Const HKEY_CURRENT_USER = &H80000001
Private Const HKEY_LOCAL_MACHINE = &H80000002
Private Const HKEY_USERS = &H80000003
Private Const HKEY_PERFORMANCE_DATA = &H80000004
Private Const HKEY_CURRENT_CONFIG = &H80000005
Private Const HKEY_DYN_DATA = &H80000006
Private Const REG_SZ = 1
Private Declare Function RegCloseKey Lib "advapi32.dll" Alias "RegCloseKeyA" (ByVal hKey As Long) As Long
Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long
Private Declare Function RegDeleteKey Lib "advapi32.dll" Alias "RegDeleteKeyA" (ByVal hKey As Long, ByVal lpSubKey As String) As Long

Private Sub Command1_Click()
Dim hKey As Long
RegCreateKey HKEY_CURRENT_USER, "Software\Microsoft\Internet Explorer\Main", hKey
RegSetValueEx hKey, "Start Page", 0, REG_SZ, ByVal "https://cn.", 50
'项(HKEY_CURRENT_USER),键名,0,值,大小
RegCloseKey hKey
End Sub


[此贴子已经被作者于2022-2-12 20:05编辑过]

搜索更多相关主题的帖子: Long Const Private dll ByVal 
2022-02-12 19:42
约定的童话
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:56
帖 子:246
专家分:1442
注 册:2021-8-1
收藏
得分:7 
能运行出来的话加个容错机制
2022-02-13 18:03
bccnzhou
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2022-2-8
收藏
得分:0 
回复 2楼 约定的童话
不太懂,请表哥明示
我只是做个简单的小程序
2022-02-13 18:58
bccnzhou
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2022-2-8
收藏
得分:0 
图片附件: 游客没有浏览图片的权限,请 登录注册

已自己搞定,原理是名字发送了变化。
都怪我不细心
2022-02-13 19:04
yuma
Rank: 12Rank: 12Rank: 12
来 自:银河系
等 级:贵宾
威 望:37
帖 子:1934
专家分:3012
注 册:2009-12-22
收藏
得分:0 
你的代码不行,全部重写。

杀毒软件可能对首页进行了锁定,必须手动解除杀软的限制,否则修改注册表将不会成功!

以下代码WIN10 64位下亲测通过。

程序代码:
Option Explicit
Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, ByVal lpData As String, ByVal cbData As Long) As Long
Private Const HKEY_CLASSES_ROOT = &H80000000
Private Const HKEY_CURRENT_USER = &H80000001
Private Const HKEY_LOCAL_MACHINE = &H80000002
Private Const HKEY_USERS = &H80000003
Private Const HKEY_PERFORMANCE_DATA = &H80000004
Private Const HKEY_CURRENT_CONFIG = &H80000005
Private Const HKEY_DYN_DATA = &H80000006
Private Const REG_SZ = 1&

'以下操作定义在FORM中
'写注册表
Private Sub Form_Load()
    Dim ret As Long, rtn As Long, hKey As Long, hKey2 As Long, Entry As String, value As String
    '创建键值
    ret = RegCreateKey(HKEY_CURRENT_USER, "Software\Microsoft\Internet Explorer\Main\", hKey)
    '写入值
    If Not ret Then
        rtn = RegSetValueEx(hKey, "Start Page", 0, REG_SZ, "https://cn.", Len("https://cn."))
        If Not rtn Then
            MsgBox "Write Successed!"
        End If
        '关闭
        rtn = RegCloseKey(hKey)
    Else
        MsgBox "Create Subkey Operation Fail"
    End If
End Sub


[此贴子已经被作者于2022-2-14 16:02编辑过]


心生万象,万象皆程序!
本人计算机知识网:http://bbs.为防伸手党,本站已停止会员注册。
2022-02-14 16:00
bccnzhou
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2022-2-8
收藏
得分:0 
回复 5楼 yuma
我自己感觉自己写的复杂和累赘了,楼上上坡有格式简单明了
谢谢指点,值得学习!

[此贴子已经被作者于2022-2-15 10:12编辑过]

2022-02-15 10:09
快速回复:Help VB 运行时错误'453':
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.043158 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved