首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

获取注册表中值的有关问题,

2012-01-08 
获取注册表中值的问题,在线等!!!!!各位大哥帮帮忙我用下面的代码去得到HKEY_LOCAL_MACHINE下SOFTWARE\Micr

获取注册表中值的问题,在线等!!!!!
各位大哥帮帮忙
我用下面的代码去得到HKEY_LOCAL_MACHINE下SOFTWARE\Microsoft\Windows\CurrentVersion\App   Paths\FwClient.exe中Path的值,但是为什么得到的确实空的啊
Dim   Read_Key   As   Long
Dim   Result   As   Long
Dim   Query_Key   As   Long
Dim   path   As   Long
Dim   Date   As   String
Dim   Binarys   As   Long
Read_Key   =   RegOpenKeyEx(HKEY_LOCAL_MACHINE,   "SOFTWARE\Microsoft\Windows\CurrentVersion\App   Paths\FwClient.exe ",   0,   KEY_ALL_ACCESS,   Result)
Query_Key   =   RegQueryValue(Result,   "Path ",   Date   ,   Binarys   )
RegCloseKey   Result

在模块中API是这样的
  'Global   Const   HKEY_LOCAL_MACHINE   =   &H80000002

  Public   Declare   Function   RegOpenKey   Lib   "advapi32.dll "   Alias   "RegOpenKeyA "   (ByVal   hKey   As   Long,   ByVal   lpSubKey   As   String,   phkResult   As   Long)   As   Long
  Public   Declare   Function   RegCloseKey   Lib   "advapi32.dll "   (ByVal   hKey   As   Long)   As   Long
  Public   Declare   Function   RegQueryValueEx   Lib   "advapi32.dll "   Alias   "RegQueryValueExA "   (ByVal   hKey   As   Long,   ByVal   lpValueName   As   String,   ByVal   lpReserved   As   Long,   lpType   As   Long,   lpData   As   Any,   lpcbData   As   Long)   As   Long
'   Note   that   if   you   declare   the   lpData   parameter   as   String,   you   must   pass   it   By   Value.
  Public   Declare   Function   RegQueryValue   Lib   "advapi32.dll "   Alias   "RegQueryValueA "   (ByVal   hKey   As   Long,   ByVal   lpSubKey   As   String,   ByVal   lpValue   As   String,   lpcbValue   As   Long)   As   Long


Public   Declare   Function   RegOpenKeyEx   Lib   "advapi32.dll "   Alias   "RegOpenKeyExA "   (ByVal   hKey   As   Long,   ByVal   lpSubKey   As   String,   ByVal   ulOptions   As   Long,   ByVal   samDesired   As   Long,   phkResult   As   Long)   As   Long
帮帮忙啊,都弄了一天了


[解决办法]
http://www.sqreg.com/file/vb/reg_01.htm
[解决办法]
在论坛上搜索一下吧,太多了,代码都贴烂了......
-_-
[解决办法]
不会吧,兄弟,你的Date变量也可以定义 吗?
还有应该使用space(length)分配空间。
[解决办法]
http://community.csdn.net/Expert/topic/5547/5547987.xml?temp=.947796

热点排行