I have a D1 program which renames a subdirectory. This works fine on Win3.1
or Win95, 98, but fails with IOResult=5 (Access denied) on NT. Does anyone
know the reason or a workaround?
code below:
procedure TForm1.Button1Click(Sender: TObject);
var
S : string;
F : file;
i : integer;
begin
S := DirectoryListBox1.Directory;
DirectoryListBox1.OnChange := nil;
DirectoryListBox1.Directory := '..';
{new
if RenameFile (S, Edit1.Text) then {only returns true/false}
S := edit1.text;
}
{old:}
System.assign (F, S);
{$I-}
rename (F, Edit1.Text);
{$I+}
i := IOResult;
if i = 0 then
S := Edit1.Text
else
ShowMessage ('rename failed'+#13+inttostr(i));
DirectoryListBox1.Directory := S;
DirectoryListBox1.Update;
DirectoryListBox1.OnChange := DirectoryListBox1Change;
end;
Thanks,
Robert Fletcher.
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz