请高手看看下面的程序
Private Sub Command1_Click()
Dim Newhandle As Long
Dim RetLength As Long
Dim RegRet As Long
Dim RegValue As String
Dim Regpath as string
Dim Regname as string
RegPath = "Software\A4Tech\WheelMouse\CurrentVersion" 
RegName = "InstallPath"
Call RegOpenKeyEx(HKEY_LOCAL_MACHINE, RegPath, 0, KEY_ALL_ACCESS, Newhandle)
RegRet = RegQueryValueEx(Newhandle, RegName, 0, REG_SZ, RegValue, RetLength) 
RegCloseKey (Newhandle&)
End Sub
现在有个问题,RegRet的值为零,RetLength的值也正确,但是Regvalue却为空,是什么原因?

解决方案 »

  1.   

    Private Sub Command1_Click()
    Dim Newhandle As Long
    Dim RetLength As Long
    Dim RegRet As Long
    Dim RegValue As String
    Dim Regpath as string
    Dim Regname as string
    RegPath = "Software\A4Tech\WheelMouse\CurrentVersion" 
    RegName = "InstallPath"
    Call RegOpenKeyEx(HKEY_LOCAL_MACHINE, RegPath, 0, KEY_ALL_ACCESS, Newhandle)
    RegRet = RegQueryValueEx(Newhandle, RegName, 0, REG_SZ,Byval RegValue, RetLength) 
    RegCloseKey (Newhandle&)
    End Sub
      

  2.   

    chenyu5188(蓝色情调),你那样我也试过,结果是一样的.thank you all the same
      

  3.   

    (litujiao)
     我也碰到与你同样的问题,不知你最后怎么解决的,急盼回复,多谢了