Hi all
I am working with Delphi 2010 and the ShellAPI. I need a little help as the program I am building grows. Here is the jest of the application:
Checks to see if a certain condition exists If said condition exists it begins to execute 2 shell commands which are dependent on the previous one executing
uses
ShellApi;
procedure RenameDir(DirFrom, DirTo: string);
var
shellinfo: TSHFileOpStruct;
begin
with shellinfo do
begin
Wnd := 0;
wFunc := FO_RENAME;
pFrom := PChar(DirFrom);
pTo := PChar(DirTo);
fFlags := FOF_FILESONLY or FOF_ALLOWUNDO or
FOF_SILENT or FOF_NOCONFIRMATION;
end;
SHFileOperation(shellinfo);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
RenameDir('C:\Dir1', 'C:\Dir2');
RenameDir('C:\Dir3', 'C:\Dir');
end;
I am a novice at Delphi but I can see the issue, the second command is executing before the previous command completes. How do I solve this issue so that the first command executes and finishes before the second one is called?
UPDATE: I added the full pseudo code so that it shows what I attempting to do.