The information in this article applies to:
SYMPTOMSThe Dir/Dir$ function in Microsoft Visual Basic 4.0 may be used to test for a file's existence. It returns the name (or names) of the files that fit the search criteria. However, when using a UNC (Universal Naming Conventions) path to search for files that exist on a network directory, the Dir$ function may not return valid information. This behavior is most common when searching Microsoft Windows NT 4.0 network paths. It can also occur when searching for files that have unusual names (such as files that have no extension). RESOLUTIONTo work around this behavior, the OpenFile API call may be used to test for the existence of a file. Passing the parameter OF_EXIST to the OpenFile function causes OpenFile to search for an existing file. It does not write to or open the file when this parameter is passing by itself. STATUSMicrosoft is researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available. MORE INFORMATION
The following sample shows how to use the OpenFile API function to check
for the existence of a file named "Test" that has no file extension and is
located at the following location: \\ServerName\ShareName:
If the file in question is found, data pertaining to that file is placed into the variable strucFname. REFERENCES
For additional information, please see the following article in the
Microsoft Knowledge Base:
Q112674 : How to Determine If a File Exists by Using DIR$ Additional query words: KBWIN32SDK KBAPI kbVBp kbdsd kbDSupport kbVBp400 kbVBp500 kbVBp600
Keywords : kbGrpVB |
Last Reviewed: January 5, 2000 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |