i use to create a custom function like winexec(...):Hwnd that will retun the handle of executed application.
i did use the findwindow() but having problem if it change w
Try example 6 from this page (http://delphidabbler.com/tips/134) and just modify it a little bit. That's what I did.
if you want to split where you check and where you review your result you can do something like
var
//...
runNext : Boolean;
//...
begin
{ startup code from other sample here }
// but instead of if
runNext := ShellExecuteEx(@SEInfo);
{ some more code here }
// need delay before running next process
// run loop until window with Handle is closed
if runNext then
with SEInfo do
repeat
GetExitCodeProcess(SEInfo.hProcess, ExitCode);
Sleep(20);
Application.ProcessMessages;
CheckSynchronize();
until (ExitCode <> STILL_ACTIVE) or Application.Terminated;
{ next process code here }
end;
I realize some of you will drop hate mail on this for throwing in Sleep(), but I'd rather not lock windows up until that execute is finished when I'm processing a boatload of stuff and waiting.