DOCUMENT:Q173009 02-OCT-1997 [vbwin] TITLE :PRB: Runtime Error 87 Using RegEnumValue Function PRODUCT :Microsoft Visual Basic for Windows PROD/VER:WINDOWS:4.0,5.0 OPER/SYS:NT WINDOWS KEYWORDS:vb432 VB4WIN vb5all ====================================================================== --------------------------------------------------------------------- The information in this article applies to: - Microsoft Visual Basic Control Creation, Learning, Professional, and Enterprise Editions for Windows, version 5.0 on the following platform: NT - Microsoft Visual Basic Standard, Professional, and Enterprise Editions, 32-bit only, for Windows, version 4.0 on the following platform: NT --------------------------------------------------------------------- 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 Operating System 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 STATUS ====== Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available. ====================================================================== Keywords : vb432 VB4WIN vb5all Version : WINDOWS:4.0,5.0 Platform : NT WINDOWS Issue type : kbprb ============================================================================= THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY. Copyright Microsoft Corporation 1997.