CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 1999
    Location
    Dublin, Ireland
    Posts
    1,173

    RegEnumKeyEx Error 87

    I keep getting the error "87 Parameter is incorrect" when calling the RegEnumKeyEx API call.

    My declaration is:

    private Declare Function RegEnumKeyEx Lib "advapi32.dll" Alias "RegEnumKeyExA" (byval hKey as Long, byval dwIndex as Long, byval lpName as string, lpcbName as Long, lpReserved as Long, byval lpClass as string, lpcbClass as Long, lpftLastWriteTime as Long) as Long




    and the use is:

    '\\ Initialise the string that are going to hold the values...
    lKeyLen = 2000
    lClassLen = 2000
    sKeyName = string$(lKeyLen, 0)
    sClassName = string$(lClassLen, 0)

    '\\ Enumerate through the keys adding each one...
    While lRet = 0
    lRet = RegEnumKeyEx(Key, lIndex, sKeyName, lKeyLen, lReserved, sClassName, lClassLen, lpftLastWriteTime)
    lIndex = lIndex + 1
    Wend




    Any ideas?
    TIA,
    Duncan
    I have checked that Key is a valid open key

    -------------------------------------------------
    Ex. Datis: Duncan Jones
    Merrion Computing Ltd
    http://www.merrioncomputing.com
    '--8<-----------------------------------------
    NEW -The printer usage monitoring application
    '--8<------------------------------------------

  2. #2
    Join Date
    Apr 2000
    Location
    South Carolina,USA
    Posts
    2,210

    Re: RegEnumKeyEx Error 87

    Your Last parameter on the declaration is wrong. here is the correct declaration


    public Type FILETIME
    dwLowDateTime as Long
    dwHighDateTime as Long
    End Type

    Declare Function RegEnumKeyEx Lib "advapi32.dll" Alias "RegEnumKeyExA" _
    (byval hKey as Long, byval dwIndex as Long, _
    byval lpname as string, lpcbName as Long, _
    byval lpReserved as Long, _
    byval lpClass as string, _
    lpcbClass as Long, _
    lpftLastWriteTime as FILETIME) as Long





    John G

  3. #3
    Join Date
    Dec 1999
    Location
    Dublin, Ireland
    Posts
    1,173

    Re: RegEnumKeyEx Error 87

    Full marks - That was precisely it.

    Thanks,
    D.

    -------------------------------------------------
    Ex. Datis: Duncan Jones
    Merrion Computing Ltd
    http://www.merrioncomputing.com
    '--8<-----------------------------------------
    NEW -The printer usage monitoring application
    '--8<------------------------------------------

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured