@KodeZerg ok that actually worked much better, at least so far so good. I adjusted (Badly) into my existing procedures (below) and it worked well.
procedure TFrameImageBrowser.MakeHidden(const fname : String);
var
attr : DWORD;
begin
if fileExists(fname) then
begin
try
attr := GetFileAttributes(pchar(fname));
if ((Attr and FILE_ATTRIBUTE_HIDDEN) <> 0) then
begin
// This is lazy
end else
begin
Attr := Attr + FILE_ATTRIBUTE_HIDDEN;
SetFileAttributes(PCHAR(fname), attr);
end;
except
//
end;
end;
sleep(50);
application.ProcessMessages;
end;
procedure TFrameImageBrowser.MakeUnHidden(const fname : String);
var
attr : DWORD;
begin
if fileExists(fname) then
begin
try
attr := GetFileAttributes(PCHAR(fname));
if ((Attr and FILE_ATTRIBUTE_HIDDEN) <> 0) then
begin
Attr := Attr and not FILE_ATTRIBUTE_HIDDEN;
SetFileAttributes(PCHAR(fname), attr);
end;
except
//
end;
end;
sleep(50);
application.ProcessMessages;
end;
As you can see the make hidden is a little clumsy in the if statement, and since I don't actually know it the file is hidden or not to toggle this method does work. Thanks for that it appears to have done the job. The problem might even have been that I don't use IniFiles to write my inifiles, I use a unit i've been using for ever that was originally intended to overcome the 64kb limit on ini files. I'm not even sure if that is even a thing anymore but it's always worked well for me.