API 写注册表问题
程序代码:
Call HKEY_SetString(HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\vstart", "", "vstart") '我设置的是Microsoft 项下写入,怎么实际变成 'HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\explorer\CommandStore\shell\vstart '在这个路径下,求研究了一个晚上, 找不到问题,求解 Public Function HKEY_SetString(ByVal lRootkey, sKeyName As String, sValueName As String, sValueValue As String, Optional lValueType = REG_SZ) As Integer Dim handle As Long, strT As String Dim RetVal As Long, lngL As Long ' 字符串长度,考虑中英文! Call AdjustToken strT = StripNulls(sValueValue) lngL = LenB(StrConv(strT, vbFromUnicode)) + 1 ' 创建键 RegCreateKey lRootkey, sKeyName, handle RetVal = RegSetValueEx(handle, sValueName, ByVal 0&, lValueType, ByVal strT, lngL) 'RetVal = RegSetValue(handle, sValueName, lValueType, ByVal strT, lngL) '// 返回关闭结果 RegCloseKey handle '// 返回写入成功结果 HKEY_SetString = IIf(RetVal = 0, 1, 0) End Function