如何使用VB6从注册表中读取(默认)键值 [英] How to read (default) key value from registry using VB6

查看:399
本文介绍了如何使用VB6从注册表中读取(默认)键值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用VB6从注册表中读取(默认)键值;



我尝试过:



How to read (Default) key value from registry using VB6;

What I have tried:

Private Sub cmdRDetails_Click()
Dim strResult As String
strResult = strResult & GetMeRegistry("ABC.OCX") + vbCrLf
End Sub
Public Function GetMeRegistry(ByVal RootKey As String) As String
txtRegistryDetail.Text=GetMeRegistry("HKEY_LOCAL_MACHINE\SOFTWARE\Classes\TypeLib\6.0\0\win32\Default")
End Function

推荐答案

参数不是可选错误

错误信息不言自明:您定义了一个带有两个参数的方法:

"Argument not optional error"
The error message is self explanatory: You define a method that takes two arguments:
Public Function GetMeRegistry(ByVal componentName As String, ByVal RootKey As String) As String

你只用一个叫它:

And you call it with only one:

GetMeRegistry("ABC.OCX")

将第二个参数添加到调用中,或从定义中删除它。

您可能还需要在某个时候从函数返回一个值...



但是......你很幸运它没有编译,因为它不起作用:

Either add the second parameter to the call, or remove it from the definition.
You probably also need to return a value from the function at some point...

But...You are lucky it doesn't compile, because it woudln't work:

Public Function GetMeRegistry(ByVal componentName As String, ByVal RootKey As String) As String
txtRegistryDetail.Text=GetMeRegistry("HKEY_...\Default")
End Function

所有它都会调用它自己,所以它会立即崩溃堆栈空间。

All it does it call itself, so it'll crash with "out of stack space" pretty much immediately.


这篇关于如何使用VB6从注册表中读取(默认)键值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆