/[projects]/dao/DelphiScanner/Components/tpsystools_4.04/examples/Delphi/exspawnu.pas
ViewVC logotype

Contents of /dao/DelphiScanner/Components/tpsystools_4.04/examples/Delphi/exspawnu.pas

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2671 - (show annotations) (download)
Tue Aug 25 18:15:15 2015 UTC (8 years, 10 months ago) by torben
File size: 2913 byte(s)
Added tpsystools component
1 (* ***** BEGIN LICENSE BLOCK *****
2 * Version: MPL 1.1
3 *
4 * The contents of this file are subject to the Mozilla Public License Version
5 * 1.1 (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 * http://www.mozilla.org/MPL/
8 *
9 * Software distributed under the License is distributed on an "AS IS" basis,
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 * for the specific language governing rights and limitations under the
12 * License.
13 *
14 * The Original Code is TurboPower SysTools
15 *
16 * The Initial Developer of the Original Code is
17 * TurboPower Software
18 *
19 * Portions created by the Initial Developer are Copyright (C) 1996-2002
20 * the Initial Developer. All Rights Reserved.
21 *
22 * Contributor(s):
23 *
24 * ***** END LICENSE BLOCK ***** *)
25
26 unit exspawnu;
27
28 interface
29
30 uses
31 Windows, SysUtils, Messages, Classes, Graphics, Controls,
32 Forms, Dialogs, StdCtrls, ShellAPI, ExtCtrls,
33
34 StBase, StSpawn;
35
36 type
37 TForm1 = class(TForm)
38 StSpawnApplication1: TStSpawnApplication;
39 btnSpawn: TButton;
40 RG1: TRadioGroup;
41 OpenDialog1: TOpenDialog;
42 cbNotify: TCheckBox;
43 cbTimeout: TCheckBox;
44 RG2: TRadioGroup;
45 procedure btnSpawnClick(Sender: TObject);
46 procedure StSpawnApplication1Completed(Sender: TObject);
47 procedure StSpawnApplication1SpawnError(Sender: TObject; Error: Word);
48 procedure StSpawnApplication1TimeOut(Sender: TObject);
49 private
50 { Private declarations }
51 public
52 { Public declarations }
53 procedure EnableControls(B : Boolean);
54 end;
55
56 var
57 Form1: TForm1;
58
59 implementation
60
61 {$R *.DFM}
62
63 procedure TForm1.EnableControls(B : Boolean);
64 begin
65 rg1.Enabled := B;
66 rg2.Enabled := B;
67 cbNotify.Enabled := B;
68 cbTimeOut.Enabled := B;
69 btnSpawn.Enabled := B;
70 end;
71
72 procedure TForm1.btnSpawnClick(Sender: TObject);
73 begin
74 if OpenDialog1.Execute then begin
75 StSpawnApplication1.FileName := OpenDialog1.FileName;
76 StSpawnApplication1.SpawnCommand := TStSpawnCommand(rg1.ItemIndex);
77 StSpawnApplication1.NotifyWhenDone := cbNotify.Checked;
78 if (rg2.ItemIndex = 0) then
79 StSpawnApplication1.ShowState := ssMinimized
80 else
81 StSpawnApplication1.ShowState := ssNormal;
82 StSpawnApplication1.TimeOut := Ord(cbTimeout.Checked) * 15;
83 EnableControls(StSpawnApplication1.TimeOut = 0);
84 StSpawnApplication1.Execute;
85 end;
86 end;
87
88 procedure TForm1.StSpawnApplication1Completed(Sender: TObject);
89 begin
90 EnableControls(True);
91 ShowMessage('Done');
92 end;
93
94 procedure TForm1.StSpawnApplication1SpawnError(Sender: TObject; Error: Word);
95 begin
96 EnableControls(True);
97 ShowMessage(IntToStr(Error));
98 end;
99
100 procedure TForm1.StSpawnApplication1TimeOut(Sender: TObject);
101 begin
102 EnableControls(True);
103 ShowMessage('TimeOut');
104 end;
105
106 end.

  ViewVC Help
Powered by ViewVC 1.1.20