Programı kurmaya geçmeden önce de if deyimiyle register kayıtlarından programın kurulu olup olmadığını kontrol ettiriyorum. Eğer yoksa kuruluma geçmeli.
Forumda yaptığım aramalar sonucu aşağıdaki kodları buldum. Ancak yine hepsi birden çalışmaya başladı.
Acaba nerde yanlış yapıyorum ya da başka bir yoldan nasıl yapabilirim?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;