Microsoft KB Archive/246288

From BetaArchive Wiki
Knowledge Base


BUG: Error in Declaration of SHFileOperation() from API Text Viewer

Article ID: 246288

Article Last Modified on 5/12/2003



APPLIES TO

  • Microsoft Visual Basic 5.0 Enterprise Edition
  • Microsoft Visual Basic 6.0 Enterprise Edition
  • Microsoft Visual Basic 5.0 Professional Edition
  • Microsoft Visual Basic 6.0 Professional Edition
  • Microsoft Visual Basic 5.0 Learning Edition
  • Microsoft Visual Basic 6.0 Learning Edition



This article was previously published under Q246288

SYMPTOMS

When you use the API Text Viewer to get the declaration for the API SHFileOperation() function, the following Declare statement is produced:

Public Declare Function SHFileOperation Lib "shell32.dll" Alias " SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As Long
                

Note that the Declare statement in the code has an embedded space character before SHFileOperationA. If you use this API in your Visual Basic code, you receive the following error message when you run your application:

Run-time error '453':

Can't find DLL entry point  SHFileOperationA in shell32.dll
                    

Note that the extra space is also present in the error message text.

RESOLUTION

The correct Declare statement is:

Public Declare Function SHFileOperation Lib "shell32.dll" Alias "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As Long
                

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

Keywords: kbbug kbshellgrp kbapi kbpending KB246288