Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: Error in Creating Registry Entry in win'2000


Message #1 by "Mohideen" <mohideen@a...> on Tue, 28 Aug 2001 09:39:51 +0530
Error 87 is (at least in W2K) 'The parameter is incorrect.'

Check if you have the correct definition of the API. As I saw
in your code, it should be like this:

Declare Function RegCreateKeyEx Lib "advapi32.dll" Alias _
   "RegCreateKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, _
   ByVal Reserved As Long, ByVal lpClass As String, ByVal dwOptions _
   As Long, ByVal samDesired As Long, ByVal lpSecurityAttributes _
   As Long, phkResult As Long, lpdwDisposition As Long) As Long

Check also that all the ByVal parameters are defined as Long (also
the constants)

m.


-----Original Message-----
From: Mohideen [mailto:mohideen@a...]
Sent: Monday, August 27, 2001 9:10 PM
To: professional vb
Subject: [pro_vb] Error in Creating Registry Entry in win'2000



Hi techies,

Can anybody help me to find out, why the following code in not working
in windows'2000 (returns 87 as the retvalue ) Syntax error). Logged in
as Administrator.

whereas the some code works well and creates the required entry in the
registry ( win95' & 98. ). Is there is any difference ?

lRetval = RegCreateKeyEx(HKEY_LOCAL_MACHINE, _
          "\Software\Alacrity\PowerMan\1.0.1", 0&, vbNullString, _
          REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, 0&, hNewKey, lRetval)
hKey = hNewKey lRetval = SetValueEx(hKey, "Commport", REG_SZ 1)

Thanks in adv.

Mohideen



  Return to Index