| || |
Extern object for FindFirstFile method
Kernel32.dll has an internal dll API-MS-WIN-CORE-FILE-L1-1-0.DLL used for file operations. FindFirstFile method available in the dll, is used to find files in a directory. Definition of FindFirstFile on msdn - https://msdn.microsoft.com/en-us/lib...(v=vs.85).aspx
I wanted to use this method in QTP/UFT for performing file operations using Extern object. But not able to come up with the declaration and usage.
Extern.Declare returntype, “FindFirstFile”, "Kernel32.dll”, “FindFirstFileA”, micString, secondparameter
Not able to figure what to provide in return type and second parameter? As per the definition of FindFirstFile, the return type is "search handle" and second parameter is a pointer to the WIN32_FIND_DATA structure.
After declaration how to use the method for finding files?
About 5 years ago Tarun create a function that allowed you to enter dll details and it would display the required UFT calling params call.
VB to QTP API Declaration converter | KnowledgeInbox
Thanks for the reply. That helped to lot extent. It still does not help me to figure the data type for pointer "lpFindFileData"?
In the converter tool, this is what i provided.
private declare function FindFirstFile Lib "kernel32" Alias "FindFirstFileA" (ByVal lpFileName As String, ByRef lpFindFileData) As Long
and the output is
'private declare function FindFirstFile Lib "kernel32" Alias "FindFirstFileA" (ByVal lpFileName As String, ByRef lpFindFileData) As Long
Extern.Declare micLong,"FindFirstFile","kernel32","FindFirstFileA ",micString,micRef+micUnknown
As per MSDN,
HANDLE WINAPI FindFirstFile(
_In_ LPCTSTR lpFileName,
_Out_ LPWIN32_FIND_DATA lpFindFileData
A pointer to the WIN32_FIND_DATA structure that receives information about a found file or directory.