Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
FindFirstFile
Message
From
29/06/2001 12:06:54
Alex Zhadanov
Computer Generated Solutions
New York City, New York, United States
 
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Title:
Miscellaneous
Thread ID:
00521676
Message ID:
00525235
Views:
15
>>Hi,people
>>I need to find file somewhere on a harddrive.
>>I have filename and drive (c: or e:)
>>I want to use API FindFirstFile to find this file.
>>How can i present WIN32_FIND_DATA structute which this API require?
>>Thank you
>
>Alex,
>
>Just to expand on what Houston said, if you do not provide FindFirstFile() with a complete path, it only searches the current working directory. In the case of using it within VFP, you'd have to re-set this via SET DEFAULT. This is the same as you'd have to do with ADIR(), if you only wish to retrieve folders (directories) for example.
>
>It does have the ability, like ADIR(), to utilize wildcards. The Scripting.FileSystemObject, however, has no facility to filter out undesired files using wildcards.
>
>About the closest you can get is the Shell.Application object's FindFile method. This presents the same dialog that the Windows Explorer does. While it can be instantiated programmatically from within VFP, there is no programmatic control (such as setting the drive) over it, and no way to programmatically retrieve the result set. Further, determining if it is even available is a two step process. First, you have to check the registry for the presence of the ProgID under HKEY_CLASSES_ROOT, then, if present, check the DLL (Shell32.dll) to assure that the version is greater than or equal to 4.71. Getting it installed, if not present can be difficult. It was an optional part of IE 4.01 (it installs with the Active Desktop), but not later versions. It's not part of Win 95, but is in Win 98 and above.
>
>This does have some utility from with the VFP development environment, however. It's a better version of Filer than we had in the past. You can simply instantiate the object from the Command window, set your search criteria and drag any of the files returned into the Command window. They will then automatically open in the appropriate designer. This applies, of course, to those files that VFP opens natively.
Thank you guys.
I already realized that API FindFirstFile will not help me. I wrote my own recursive function with ADIR() and it works fine.Only one complication:
every time when i call my function in recursive loop i need to create new array for ADIR() function and later release this array.It works but it does not look nice.
Alex
ADIR() function
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform