CPB Mailing List
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: FindFirstFile??
From the Win32 Reference helpfile that was shipped with your copy of
CBuilder...
Handle FindFIrstFile(
LPCTSTR lpFileName,
LPWIN32_FIND_DATA lpFindFileData
);
lpFileName - points to null-terminated string specifying a valid
directory or path and filename which can contain wildcard characters
(* and ?)
NOTE: This means you need to supply "C:\windows\*.pwl" as the lpFileName
parameter.
lpFileFindData - points to the WIN32_FIND_DATA structure that receives
information about the found file or subdirectory.
NOTE: This means you need to declare a structure
WIN32_FIND_DATA fileFound;
and pass &fileFound as the 2nd parameter to the function call.
HANDLE - if function succeeds it returns a handle that is used during
calls to FindNextFile or FindClose. If it fails the function call
returns INVALID_HANDLE_VALUE.
Soooooo. just taking about 30 seconds to look at the helpfile, you need
to code the following:
AnsiString searchString = "C:\windows\*.pwl";
WIN32_FIND_DATA fileFound;
HANDLE searchHandle;
searchHandle=FindFirstFile(searchString.c_str(),&fileFound);
if(searchHandle != INVALID_HANDLE_VALUE)
{
// loop to process and call FindNextFile here
}
FindNextFile is quite simple and only requires a single loop to process
until it returns zero (indicating failure). The WIN32_FIND_DATA
documentation will tell you what sort of information is available when
the search is successful, but you'll have to read it for yourself. I
think I've violated enough of Microsoft's copyright for one post.
Daniel Hallmark
W Komornicki's Home Page |
Main Index |
Thread Index