Microsoft KB Archive/173009

From BetaArchive Wiki
< Microsoft KB Archive
Revision as of 11:06, 21 July 2020 by X010 (talk | contribs) (Text replacement - """ to """)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Base


Article ID: 173009

Article Last Modified on 6/29/2004



APPLIES TO

  • Microsoft Visual Basic 5.0 Control Creation Edition, when used with:
    • Microsoft Windows NT 4.0
  • Microsoft Visual Basic 5.0 Learning Edition, when used with:
    • Microsoft Windows NT 4.0
  • Microsoft Visual Basic 5.0 Professional Edition, when used with:
    • Microsoft Windows NT 4.0
  • Microsoft Visual Basic 5.0 Enterprise Edition, when used with:
    • Microsoft Windows NT 4.0
  • Microsoft Visual Basic 4.0 Standard Edition, when used with:
    • Microsoft Windows NT 4.0
  • Microsoft Visual Basic 4.0 Professional Edition, when used with:
    • Microsoft Windows NT 4.0
  • Microsoft Visual Basic 4.0 32-Bit Enterprise Edition, when used with:
    • Microsoft Windows NT 4.0



This article was previously published under Q173009

SYMPTOMS

When attempting to call the RegEnumValue API from Visual Basic or Visual Basic for Applications code, you may receive the following error:

Error 87 - Invalid Parameter


This problem occurs if you are running the Windows NT 4.0 or Windows 2000 Operating Systems and you have obtained the declaration for the RegEnumValue API from Visual Basic's API Text Viewer program.

CAUSE

The Declare statement for RegEnumValue in Visual Basic's API Text Viewer is incorrect.

RESOLUTION

The declaration of RegEnumValue as it currently exists in the API Text Viewer is:

   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 Any, lpcbData As Long) As Long
                


The fifth parameter, lpReserved, should be defined as ByVal. The correct declaration is:

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


You can also change the statement in the file win32api.txt so the next time you use the API Text Viewer, the Declare statement will be correct.

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This bug has been fixed in Visual Basic 6.0.

REFERENCES

An updated version of the Win32API.txt file is available for download for registered users of Visual Basic. For more information about downloading this file, please see the following Knowledge Base article:

178020 : FILE: WIN32API.EXE: Updated Version of Win32api32.txt File


Keywords: kbbug kbfix kbapi kbvbp600fix KB173009