我现在取环境变量path的他的位置在注册表里的
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Environment 这个下面我现在写的取值格式不知道对不对? 请大家指教下? s = QueryValue(HKEY_LOCAL_MACHINE, "SYSTEM\ControlSet001\Control\Session Manager\Environment", "Path")用这个我取出来的是空值
下面是API代码 从 http://topic.csdn.net/t/20030124/15/1390232.html 这个地方拷贝过来用的
请大家指教下 急用 谢谢~
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Environment 这个下面我现在写的取值格式不知道对不对? 请大家指教下? s = QueryValue(HKEY_LOCAL_MACHINE, "SYSTEM\ControlSet001\Control\Session Manager\Environment", "Path")用这个我取出来的是空值
下面是API代码 从 http://topic.csdn.net/t/20030124/15/1390232.html 这个地方拷贝过来用的
请大家指教下 急用 谢谢~
解决方案 »
- msgbox框出来以后,如果一定时间内没有人点确定,那怎么让这个框消失,使程序自动运行?
- 想问问一下wsock api函数
- mshflexgrid表格能否设置每一行的颜色不同?
- 高手们,新年快乐!兄弟我有一个问题,已经半个多月没有找到答案了,希望指教!!!
- 如何将网也上的图片接取下来保存到硬盘中?
- 报表的时候想加上图片怎么打印出来
- 想在VB中输入一个矩阵 行列数均不定 但是不想用MATRIXVB插件 应该怎么编程
- 请问怎么用vbscript写一个10秒倒计时的程序?
- 菜鸟问题,请进来看一看,举手之劳,谢谢!
- 如何设置"Shift+Tab"次序?
- 请教关于使用Inet控件FTP上传文件的问题,请高手解答
- VB怎么在存储过程中返回Return值?
Function QueryValueEx(ByVal lhKey As Long, ByVal szValueName As String, vValue As Variant) As Long
Dim cch As Long
Dim lrc As Long
Dim lType As Long
Dim lValue As Long
Dim sValue As String
On Error GoTo QueryValueExError
lrc = RegQueryValueExNULL(lhKey, szValueName, 0&, lType, 0&, cch)
If lrc <> ERROR_NONE Then Error 5
Select Case lType
Case REG_SZ,2:
sValue = String(cch, 0)
lrc = RegQueryValueExString(lhKey, szValueName, 0&, lType, sValue, cch)
If lrc = ERROR_NONE Then
vValue = Left$(sValue, cch - 1)
Else
vValue = Empty
End If
Case REG_DWORD:
lrc = RegQueryValueExLong(lhKey, szValueName, 0&, lType, lValue, cch)
If lrc = ERROR_NONE Then vValue = lValue
Case Else
lrc = -1
End Select
QueryValueExExit:
QueryValueEx = lrc
Exit Function
QueryValueExError:
Resume QueryValueExExit
End Function lType=2也是字符串类型
Select Case lType 这地方漏了一个判断,给你改了一下