Examples Delphi

Title: Wait for a process to finish
Question: By querying the GetModuleUsage of a particular handle you can determine if the process is finished.
Answer:
Waiting for a process to finish
Var
Handle : Word;
begin
Handle := WinExec('Appname.exe',SW_ShowNormal);
While GetModuleUsage(Handle) 0 do
Application.Processmessages;
end;