问题描述
这行代码存在一些问题
I am having some problems with this line of code
If RegQueryValueEx(hKey, Value, 0, pdwType, Nothing, pvSize) = ERROR_NONE Then
对于任何了解注册表的人,我想知道如何更正此行,以便它与我的vb.net应用程序一起使用.
函数中未列出的变量是
to anyone with knowledge about the registry I would like to know how to correct this line so that it works with my vb.net application.
the variable not listed in the function is
Private Const ERROR_NONE As Integer = &H0
这里又是一个完整的功能
And here it is once more as a full function
Public Function ValueExists(ByVal RootKey As ROOT_KEY, ByVal SubKey As String, ByVal Value As String) As Boolean
Dim hKey As UIntPtr = UIntPtr.Zero
Dim pvSize As UInteger = 0
Dim pdwType As UInteger = CUInt(VALUE_TYPE.REG_NONE)
Try
If RegOpenKeyEx(RootKey, SubKey, 0, KEY_QUERY_VALUE, hKey) <> ERROR_NONE Then
Return False
End If
Return (RegQueryValueEx(hKey, Value, 0, pdwType, Nothing, pvSize) = ERROR_NONE)
Finally
If hKey <> UIntPtr.Zero Then
RegCloseKey(hKey)
End If
End Try
End Function
我已将其从C#转换为vb.net,但完整显示错误
错误3重载解析失败,因为对于这些参数,没有可访问的"RegQueryValueEx"是最特定的:
``公共共享函数RegQueryValueEx(hKey作为System.UIntPtr,lpValueName作为字符串,lpReserved作为整数,ByRef lpType作为UInteger,ByRef lpData作为字节,ByRef lpcbData作为UInteger)作为整数'' ``公共共享函数RegQueryValueEx(hKey作为System.UIntPtr,lpValueName作为字符串,lpReserved作为整数,ByRef lpType作为UInteger,lpData作为System.Text.StringBuilder,ByRef lpcbData作为UInteger)作为整数'':并非最具体. C:\ Users \ Admin \ Desktop \ cLightning.vb 1095 24
I have translated this from C# to vb.net but get the error in full
Error3Overload resolution failed because no accessible ''RegQueryValueEx'' is most specific for these arguments:
''Public Shared Function RegQueryValueEx(hKey As System.UIntPtr, lpValueName As String, lpReserved As Integer, ByRef lpType As UInteger, ByRef lpData As Byte, ByRef lpcbData As UInteger) As Integer'': Not most specific.
''Public Shared Function RegQueryValueEx(hKey As System.UIntPtr, lpValueName As String, lpReserved As Integer, ByRef lpType As UInteger, lpData As System.Text.StringBuilder, ByRef lpcbData As UInteger) As Integer'': Not most specific.C:\Users\Admin\Desktop\cLightning.vb109524
推荐答案
这篇关于重载解析失败?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!