如何实现通过Checkbox选项依次运行各应用程序。判断CheckBox是否选择,然后运行并等待外部程序结束,(外部程序可自动结束),然后执行下一个Checkbox是否选择。现在等待执行是CreateProcess来实现的。现在出现的情况是选中的Checkbox同时运行了。如何让他们排队运行呢?
解决方案 »
- 请问 Delphi对尾递归进行优化吗?是从哪个版本开始的?或用什么编译指示字?
- 散分,头100人有效!
- 弱弱的问一个pascal的语法,关于集合类型的表达式
- 为何winexec('tpc 1.pas>1.log',sw_normal)在win98下不能编译而在XP则可以?
- 有哪为大虾帮我看一下如何翻译成Object Passcal (验证通过马上给分)
- 请问如何操作一个字节中每一位
- 通过一个exe 生成另一个EXE
- 请问如何对edit中的文本进行日期有效性的检查?
- @@@@@怎么获得本机的IP地址?@@@@@
- 窗体的调用,动态数据交叉调用的方法,有谁做过这个的程序模块?
- ASP和DELPHI版的AES加解密算法互解~~~
- delphi中webservice传递对象问题
function WinExecAndWait32(FileName: string; Visibility: Boolean): integer;
var
zAppName: array[0..512] of char;
StartupInfo: TStartupInfo;
ProcessInfo: TProcessInformation;
exitCode: Dword;
aVisibility: integer;
begin
StrPCopy(zAppName, FileName);
FillChar(StartupInfo, Sizeof(StartupInfo), #0);
StartupInfo.cb := Sizeof(StartupInfo);
StartupInfo.dwFlags := STARTF_USESHOWWINDOW;
if Visibility then
aVisibility := 1
else
aVisibility := 0;
StartupInfo.wShowWindow := aVisibility;
if not CreateProcess(nil, zAppName, nil, nil, false, CREATE_NEW_CONSOLE or NORMAL_PRIORITY_CLASS, nil, nil, StartupInfo, ProcessInfo) then
Result := -1
else
begin
WaitforSingleObject(ProcessInfo.hProcess, INFINITE);
GetExitCodeProcess(ProcessInfo.hProcess, exitCode);
result := Exitcode;
end;
end;
var
InstanceID: THandle;
Success: Boolean;begin
installdrv1.enabled:=false;
installdrv2.enabled:=false;
installdrv3.enabled:=false;
installdrv4.enabled:=false;
installdrv5.enabled:=false;
installdrv6.enabled:=false;
exit.enabled:=false;
install.enabled:=false;
if drv1.Checked=true then
begin Success := False;
try
Num:=Num+1;
State1.Lines.Add('');
State1.Lines.Add('Chipset Driver Checked.');
State1.Lines.Add('Chipset Driver Installing...');
State1.Lines.Add('Please wait...');
InstanceID := RunAndWait( PChar(ExtractFileDir(paramstr(0))+'\i1300\inf\8.6.0.1008\Intel Chipset Driver Installation UtilityPV8.6.0.1008\infinst_autol.exe -s'),1,PChar(ExtractFileDir(paramstr(0))+'\i1300\inf\8.6.0.1008\Intel Chipset Driver Installation UtilityPV8.6.0.1008\'));
Success := InstanceID >= 32;
finally if not Success then
begin
State1.Lines.Add('');
State1.Lines.Add('ERROR: Chipset Driver Not Found!');
end
end;
State1.Lines.Add('');
State1.Lines.Add('Chipset Driver Installed.');
if ((drv2.Checked=true) AND (Success=True)) OR (drv1.Checked=false) then
begin
Success := False;
try Num:=Num+1;
State1.Lines.Add('');
State1.Lines.Add('VGA Driver Checked.');
State1.Lines.Add('VGA Driver Installing...');
State1.Lines.Add('Please wait...');
if GetSystemStr='Windows 32' then
begin
InstanceID := RunAndWait( PChar(ExtractFileDir(paramstr(0))+'\i1300\VGA\Windows_OLD\WMD20070622.WHQL.Win32\ServerEngines G200e SETUP.exe'),1,PChar(ExtractFileDir(paramstr(0))+'\i1300\VGA\Windows_OLD\WMD20070622.WHQL.Win32\'));
Success := InstanceID >= 32;
end
else if (GetSystemStr='Windows Xp') OR (GetSystemStr='Windows 2003') then //XP&2003 if GetSystemXbit='x64' then
begin
InstanceID := RunAndWait( PChar(ExtractFileDir(paramstr(0))+'\i1300\VGA\WMD20080229.1966.P2.Win64-2003\ServerEngines G200e SETUP.exe'),1,PChar(ExtractFileDir(paramstr(0))+'\i1300\VGA\WMD20080229.1966.P2.Win64-2003\'));
Success := InstanceID >= 32;
end
else
begin
InstanceID := RunAndWait( PChar(ExtractFileDir(paramstr(0))+'\i1300\VGA\WMD20080229.1966.P2.Win32-2003\ServerEngines G200e SETUP.exe'),1,PChar(ExtractFileDir(paramstr(0))+'\i1300\VGA\WMD20080229.1966.P2.Win32-2003\'));
Success := InstanceID >= 32;
end
else if (GetSystemStr='Windows Vista') OR (GetSystemStr='Windows Server 2008') OR (GetSystemStr='Windows 7') OR (GetSystemStr='Windows Server 2008 R2') then
if GetSystemXbit='x64' then
begin
InstanceID := RunAndWait( PChar(ExtractFileDir(paramstr(0))+'\i1300\VGA\WMD20080229.1966.P2.Win64-2008\ServerEngines G200e SETUP.exe'),1,PChar(ExtractFileDir(paramstr(0))+'\i1300\VGA\WMD20080229.1966.P2.Win64-2008\'));
Success := InstanceID >= 32;
end
else
begin
InstanceID := RunAndWait( PChar(ExtractFileDir(paramstr(0))+'\i1300\VGA\WMD20080229.1966.P2.Win32-2008\ServerEngines G200e SETUP.exe'),1,PChar(ExtractFileDir(paramstr(0))+'\i1300\VGA\WMD20080229.1966.P2.Win32-2008\'));
Success := InstanceID >= 32;
end else
begin
State1.Lines.Add('');
State1.Lines.Add('The operating system does not support!');
State1.Lines.Add('Please Try manually install!');
Success:= False;
end;
finally
if not Success then
begin
State1.Lines.Add('');
State1.Lines.Add('ERROR: VGA Driver Not Found!');
end
end;
State1.Lines.Add('');
State1.Lines.Add('VGA Driver Installed.');
if ((drv3.Checked=true) AND (Success=True)) OR ((drv1.Checked=false) AND (drv2.Checked=false)) then
begin Success := False;
try Num:=Num+1;
State1.Lines.Add('');
State1.Lines.Add('LAN Driver Checked.');
State1.Lines.Add('LAN Driver Installing...');
State1.Lines.Add('Please wait...');
if GetSystemStr='Windows 32' then //<Windows other
begin
InstanceID := RunAndWait( PChar('msiexec /i '+ExtractFileDir(paramstr(0))+'\i1300\LAN\Dragon_Lake_5_OEM_Gen_158906\APPS\PROSETDX\Win32\PROSETDX.msi /passive /quiet'),1,Pchar(ExtractFileDir(paramstr(0))+'\i1300\LAN\Dragon_Lake_5_OEM_Gen_158906\APPS\PROSETDX\Win32\'));
Success := InstanceID >= 32;
end
else if (GetSystemStr='Windows Xp') OR (GetSystemStr='Windows 2003') then //XP&2003 if GetSystemXbit='x64' then
begin
InstanceID := RunAndWait( PChar('msiexec /i '+ExtractFileDir(paramstr(0))+'\i1300\LAN\Dragon_Lake_5_OEM_Gen_158906\APPS\PROSETDX\Winx64\PROSETDX.msi /passive /quiet'),1,Pchar(ExtractFileDir(paramstr(0))+'\i1300\LAN\Dragon_Lake_5_OEM_Gen_158906\APPS\PROSETDX\Winx64\'));
Success := InstanceID >= 32;
end
else
begin
InstanceID := RunAndWait( PChar('msiexec /i '+ExtractFileDir(paramstr(0))+'\i1300\LAN\Dragon_Lake_5_OEM_Gen_158906\APPS\PROSETDX\Win32\PROSETDX.msi /passive /quiet'),1,Pchar(ExtractFileDir(paramstr(0))+'\i1300\LAN\Dragon_Lake_5_OEM_Gen_158906\APPS\PROSETDX\Win32\'));
Success := InstanceID >= 32;
end
else if (GetSystemStr='Windows Vista') OR (GetSystemStr='Windows Server 2008') OR (GetSystemStr='Windows 7') OR (GetSystemStr='Windows Server 2008 R2') then if GetSystemXbit='x64' then
begin
InstanceID := RunAndWait( PChar('msiexec /i '+ExtractFileDir(paramstr(0))+'\i1300\LAN\Dragon_Lake_5_OEM_Gen_158906\APPS\PROSETDX\Vistax64\PROSETDX.msi /passive /quiet'),1,Pchar(ExtractFileDir(paramstr(0))+'\i1300\LAN\Dragon_Lake_5_OEM_Gen_158906\APPS\PROSETDX\Vistax64\'));
Success := InstanceID >= 32;
end
else
begin
InstanceID := RunAndWait( PChar('msiexec /i '+ExtractFileDir(paramstr(0))+'\i1300\LAN\Dragon_Lake_5_OEM_Gen_158906\APPS\PROSETDX\Vista32\PROSETDX.msi /passive /quiet'),1,Pchar(ExtractFileDir(paramstr(0))+'\i1300\LAN\Dragon_Lake_5_OEM_Gen_158906\APPS\PROSETDX\Vista32\'));
Success := InstanceID >= 32;
end else
begin
State1.Lines.Add('');
State1.Lines.Add('The operating system does not support!');
State1.Lines.Add('Please Try manually install!');
Success:= False;
end;
finally
if not Success then
begin
State1.Lines.Add('');
State1.Lines.Add('ERROR: LAN Driver Not Found!');
end
end;
State1.Lines.Add('');
State1.Lines.Add('LAN Driver Installed.');
if ((drv5.Checked=true) AND (Success=True)) OR ((drv1.checked=false) AND (drv2.Checked=false) AND (drv3.Checked=false)) then
begin Success := False;
try Num:=Num+1;
State1.Lines.Add('');
State1.Lines.Add('SATA RAID utility Checked.');
State1.Lines.Add('SATA RAID utility Installing...');
State1.Lines.Add('Please wait...'); InstanceID := RunAndWait( PChar(ExtractFileDir(paramstr(0))+'\i1300\RAID\IMSM_7.8.0.1012\iata_cd.exe -s'),1,PChar(ExtractFileDir(paramstr(0))+'\i1300\RAID\IMSM_7.8.0.1012\'));
Success := InstanceID >= 32;
finally if not Success then
begin
State1.Lines.Add('');
State1.Lines.Add('ERROR: SATA RAID utility Not Found!');
end
end;
State1.Lines.Add('');
State1.Lines.Add(' SATA RAID utility Installed.');
if (drv6.Checked=true) AND (Success=True) OR ((drv1.Checked=false) AND (drv2.Checked=false) AND (drv3.Checked=false) AND (drv5.Checked=false)) then
begin Success := False;
try Num:=Num+1;
State1.Lines.Add('');
State1.Lines.Add('TPM Checked.');
State1.Lines.Add('TPM Installing...');
State1.Lines.Add('Please wait...'); InstanceID := RunAndWait( PChar(ExtractFileDir(paramstr(0))+'\IFX_TPM_Professional_Package_SW_3[1].0_SP1\setup.exe /s /v/qn'),1,PChar(ExtractFileDir(paramstr(0))+'\IFX_TPM_Professional_Package_SW_3[1].0_SP1\'));
Success := InstanceID >= 32;
finally
if not Success then
begin
State1.Lines.Add('');
State1.Lines.Add('ERROR: TPM Not Found!');
end
end;
State1.Lines.Add('');
State1.Lines.Add(' TPM Installed.'); installdrv1.enabled:=true;
installdrv2.enabled:=true;
installdrv3.enabled:=true;
installdrv4.enabled:=true;
installdrv5.enabled:=true;
installdrv6.enabled:=true;
exit.enabled:=true;
install.enabled:=true;
State1.Lines.Add('');
State1.Lines.Add(' All Chooses Installed.');
end;//end6
end;//end5
end;//end3
end; //end2
end; //end