Posted by SalmiSoft on March 21, 20012
In Reply to GetOpenFile posted by Mark Kimball on February 08, 20012
Haven't tried it but something like this ought to work:var
OpenFileName : TOpenFileName;
szFile : array[0..WHATEVER] of Char;
pFile : PChar;
aFile : string;
FileNames : TStringList;
begin
FileNames := TStringList.Create;
try
// initialise OpenFileName, including:
OpenFileName.lpstrFile = szFile
if GetOpenFileName(OpenFileName) then
begin
DirName := string(szFile);
pFile := @szFile[length(DirName)+1];
repeat
aFile := string(pFile);
if length(aFile) > 0 then
begin
FileNames.Add(aFile);
inc(pFile, length(aFile)+1);
end;
until length(aFile) = 0;
// Do what you like with the data.
// DirName is obvious.
// FileNames.Count is the num of files
// FileNames[0], FileNames[1] etc are their names
DoJob(DirName, FileNames);
end
finally
FileNames.free;
end;
Related articles
Follow Ups