bir autorun programı yazdım ve bunun içerisindeki bazı programlar katılımsız kurulum ile kuruluyor. Ben bu programları tek bir düğmede toplayarak hepsini birden PCye kurdurmak istiyorum. Yalnız bir düğmenin altına winexec komutlarını sıraladığım zaman programların hepsi birden kurulmaya başlıyor. Benim istediğim ise; sırayla kurulmaları, bir programın kurulumu bittikten sonra bir diğerinin kurulumunun başlaması...
Ben şu şekilde yazıyorum ve hepsi birden kurulmaya başlıyor, bunu nasıl teker teker kurdurabilirim...
function ExecWait(const Cmd: string): Integer;
var
ProcessInfo: TProcessInformation;
hProcess: THandle;
ReturnCode: Integer;
StartupInfo: TStartupInfo;
procedure ChkBool(Value: Boolean; const Msg: string);
begin
if (Value = false) then
raise exception.create(Msg);
end;
begin
FillChar(StartupInfo, SizeOf(StartupInfo), 0);
ChkBool(CreateProcess(nil, PChar(Cmd), nil, nil, False,
CREATE_DEFAULT_ERROR_MODE + NORMAL_PRIORITY_CLASS,
nil, nil, StartupInfo, ProcessInfo),
'Error during CreateProcess');
hProcess := ProcessInfo.hProcess; // save the process handle
//Close the thread handle as soon as it is no longer needed
CloseHandle(ProcessInfo.hThread);
ReturnCode := WaitForSingleObject(hProcess, INFINITE);
ChkBool(dword(ReturnCode) <> WAIT_FAILED, 'Error in WaitForSingleObject');
// The process terminated
ChkBool(GetExitCodeProcess(hProcess, dword(Result)),
'Error in GetExitCodeProcess');
// Close the process handle as soon as it is no longer needed
ChkBool(CloseHandle(hProcess), 'Error in process Close Handle');
end;