PLEASE HELP: Using the NT registry from VB5.0 
Author Message
 PLEASE HELP: Using the NT registry from VB5.0

I currently have the need for storing various runtime information in the
windows NT4.0 registry. To build the registrytree i'm using the Win32 API
(regCreateKey and regSetValue) and this is working all fine.

At program start I need to trace through some of these values, and for this
i'm using
the regEnumValues to scan through the values. For some reason this work fine
under Win95/98, but not under WinNT (I get the errormsg. "Invalid
parameter"). I don't quite understand this because that I thought that both
95 and NT were using the same API.

The code fragment that causes the error is included below:

  Dim ValueName As String
  Dim ValueValue() As Byte
  Dim ValueType AS Long

  cNameMax = 255
  i = 0

  ValueNameLen = cNameMax + 1
  ValueValueLen = cNameMax + 1
  ValueName = String$(cNameMax, 0)
  ValueValue = String$(cNameMax, 0)

  check = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "software\MyApp\MyForm",
REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, key)    ' Returns key

  check = RegEnumValue(key, i, ValueName, ValueNameLen, 0&, ValueType,
ValueValue(0), ValueValueLen)            ' Causes error INVALID_PARAMENTER

Why does the RegEnumValue work under Win95, but not under NT4.0 ???

Please help
Kind Regards

    Mads H?ffner





Sun, 17 Sep 2000 03:00:00 GMT  
 PLEASE HELP: Using the NT registry from VB5.0

Which declare statement do you use?

Mads H?ffner schrieb in Nachricht ...

Quote:
>I currently have the need for storing various runtime information in the
>windows NT4.0 registry. To build the registrytree i'm using the Win32 API
>(regCreateKey and regSetValue) and this is working all fine.

>At program start I need to trace through some of these values, and for this
>i'm using
>the regEnumValues to scan through the values. For some reason this work
fine
>under Win95/98, but not under WinNT (I get the errormsg. "Invalid
>parameter"). I don't quite understand this because that I thought that both
>95 and NT were using the same API.

>The code fragment that causes the error is included below:

>  Dim ValueName As String
>  Dim ValueValue() As Byte
>  Dim ValueType AS Long

>  cNameMax = 255
>  i = 0

>  ValueNameLen = cNameMax + 1
>  ValueValueLen = cNameMax + 1
>  ValueName = String$(cNameMax, 0)
>  ValueValue = String$(cNameMax, 0)

>  check = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "software\MyApp\MyForm",
>REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, key)    ' Returns key

>  check = RegEnumValue(key, i, ValueName, ValueNameLen, 0&, ValueType,
>ValueValue(0), ValueValueLen)            ' Causes error INVALID_PARAMENTER

>Why does the RegEnumValue work under Win95, but not under NT4.0 ???

>Please help
>Kind Regards

>    Mads H?ffner






Sun, 17 Sep 2000 03:00:00 GMT  
 PLEASE HELP: Using the NT registry from VB5.0

Hi Martin

I'm using the following decleare statement (I took it from the WIN32API.txt
file)

Declare Function RegEnumValue Lib "advapi32.dll" Alias "RegEnumValueA"
(ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpValueName As String,
lpcbValueName As Long, lpReserved As Long, lpType As Long, lpData As Byte,
lpcbData As Long) As Long

Kind Regards

    Mads H?ffner





Sun, 17 Sep 2000 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. PLEASE HELP: Using the NT registry from VB5

2. REGISTRY, NT, VB5, API, PLease Help

3. REGISTRY, NT, VB5, API, PLease Help

4. REGISTRY,NT,VB5 and API, Please HELP

5. VB4 GetSetting() NT Registry - Help Please.

6. VB4 GetSetting() NT Registry - Help Please.

7. PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP,

8. VB5 Systray, Registry Issues and NT 4.0 - Pleaes Help

9. Registry Problems Help Please! - registry.bas (0/1)

10. Registry Problems Help Please! - registry.bas (1/1)

11. Help: Using MSCOMM in VB5 in NT

12. Object registry problem VB5/Off97/NT

 

 
Powered by phpBB® Forum Software