Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2008 Feb : Vista: FindFirst/FindNext problems
| Subject: | Vista: FindFirst/FindNext problems |
| Posted by: | "e1" (than..@but-no-thanks.com) |
| Date: | Thu, 28 Feb 2008 09:38:10 |
Hi,
I'm porting one of my applications to Vista and I can't make
FindFirst/FindNext work. The working directory is
CSIDL_COMMON_APPDATA (I have a subdirectory there and I'm trying to read
from it). Here is how the application is supposed to work:
I have a server dll written in Visual Studio (C++) and registered with
regsvr32. This dll is creating some text files with the .000 extension.
The Delphi application is looking for .000 files and process them. The
dll work fine, creates the files, but the delphi application doesn't see
any files in the folder.
My code works fine in XP.
procedure TTestForm.GetTheFileList(sourcedir, fileprefix, ext: string);
var
sr: TSearchRec;
FileAttrs: Integer;
begin
ListBox1.Clear;
FileAttrs := (faAnyFile and not faDirectory);
if SysUtils.FindFirst(sourcedir + fileprefix + ext, FileAttrs, sr) =
0 then
begin
if (sr.Attr and FileAttrs) = sr.Attr then
if ExtractFileName(sr.Name) <> '' then
ListBox1.Items.Add(sourcedir + sr.Name);
while SysUtils.FindNext(sr) = 0 do
begin
if (sr.Attr and FileAttrs) = sr.Attr then
if ExtractFileName(sr.Name) <> '' then
ListBox1.Items.Add(sourcedir + sr.Name);
end;
SysUtils.FindClose(sr);
end;
end;
TIA
-ioan