调用RegCreateKey(HKEY_LOCAL_MACHINE, sRegistryKey, lKeyId)
时返回值是161。
时返回值是161。
解决方案 »
- 用vb两年多了,控件,api,多媒体,网络编程,vba,com,资源都不会
- 请问如何获得当前所有盘符的详细类型? GetDriveType 得到的信息太粗略了
- 不太懂vb,帮忙看下成语接龙的程序,或一起讨论以下成语接龙的算法(100分)
- vb6取得网址的命令Webbrowser1.Document.Links(i).href,在VB.Net怎么表示?
- `
- 大家知道那有很全的VB控件吗?
- 第二次提问关于模糊查询的问题,请教高手,谢谢!
- ADO + Access + 模糊匹配 DataGrid返回数据 代码???
- 不要笑我!
- 最最最强列声讨,本来我要在我的服务器(www.china-2008.com)上放一些原代码让大家下载,由于我对WIN2000 SERVER不懂,导致服务器早上乱叫,不停的死机,我做好的网页也放不上去!
- 怎样用ctrl+Enter来作为一个按钮的快捷方式?
- 高手指点!语法加亮算法!!
dim hKey as long
dim RetVal as longRegCreateKeyEx(HKEY_LOCAL_MACHINE,sRegistryKey,0,vbnullstring,REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,0,hKey,RetVal)
Set WshShell = CreateObject("WScript.Shell")
msgbox WshShell.RegRead("HKCU\ScriptEngine\Val") ' Read from value "Val".
msgbox WshShell.RegRead("HKCU\ScriptEngine\Key\") ' Read from key "Key".2.使用API
Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
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 RegEnumKeyEx Lib "advapi32.dll" Alias "RegEnumKeyExA" (ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpName As String, lpcbName As Long, ByVal lpReserved As Long, ByVal lpClass As String, lpcbClass As Long, lpftLastWriteTime As Any) As Long
Private Declare Function RegEnumValue Lib "advapi32.dll" Alias "RegEnumValueA" (ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpValueName As String, lpcbValueName As Long, ByVal lpReserved As Long, lpType As Long, lpData As Byte, lpcbData As Long) As Long
最简单的办法是用wscript.shell对象,这样做不需要管是在98还是2000
读注册表:
Set WshShell = Wscript.CreateObject("Wscript.Shell")WshShell.RegRead("HKCU\ScriptEngine\Val") ' Read from value "Val"
WshShell.RegRead("HKCU\ScriptEngine\Key\") ' Read from key "Key"
其他用法在msdn上有详细说明