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 |
#include <vcl\vcl.h>
|
27 |
#pragma hdrstop
|
28 |
|
29 |
#include "exspawnu.h"
|
30 |
//---------------------------------------------------------------------------
|
31 |
#pragma link "StSpawn"
|
32 |
#pragma link "StBase"
|
33 |
#pragma resource "*.dfm"
|
34 |
TForm1 *Form1;
|
35 |
//---------------------------------------------------------------------------
|
36 |
__fastcall TForm1::TForm1(TComponent* Owner)
|
37 |
: TForm(Owner)
|
38 |
{
|
39 |
}
|
40 |
//---------------------------------------------------------------------------
|
41 |
void __fastcall TForm1::EnableControls(bool B)
|
42 |
{
|
43 |
RG1->Enabled = B;
|
44 |
RG2->Enabled = B;
|
45 |
cbNotify->Enabled = B;
|
46 |
cbTimeout->Enabled = B;
|
47 |
btnSpawn->Enabled = B;
|
48 |
}
|
49 |
//---------------------------------------------------------------------------
|
50 |
void __fastcall TForm1::StSpawnApplication1Completed(TObject *Sender)
|
51 |
{
|
52 |
EnableControls(true);
|
53 |
ShowMessage("Done");
|
54 |
}
|
55 |
//---------------------------------------------------------------------------
|
56 |
void __fastcall TForm1::StSpawnApplication1SpawnError(TObject *Sender,
|
57 |
WORD Error)
|
58 |
{
|
59 |
EnableControls(true);
|
60 |
ShowMessage(IntToStr(Error));
|
61 |
}
|
62 |
//---------------------------------------------------------------------------
|
63 |
void __fastcall TForm1::StSpawnApplication1TimeOut(TObject *Sender)
|
64 |
{
|
65 |
EnableControls(true);
|
66 |
ShowMessage("Timed Out");
|
67 |
}
|
68 |
//---------------------------------------------------------------------------
|
69 |
void __fastcall TForm1::btnSpawnClick(TObject *Sender)
|
70 |
{
|
71 |
if (OpenDialog1->Execute()) {
|
72 |
StSpawnApplication1->FileName = OpenDialog1->FileName;
|
73 |
StSpawnApplication1->SpawnCommand = TStSpawnCommand(RG1->ItemIndex);
|
74 |
StSpawnApplication1->NotifyWhenDone = cbNotify->Checked;
|
75 |
if (RG2->ItemIndex == 0)
|
76 |
StSpawnApplication1->ShowState = ssMinimized;
|
77 |
else
|
78 |
StSpawnApplication1->ShowState = ssNormal;
|
79 |
if (cbTimeout->Checked)
|
80 |
StSpawnApplication1->TimeOut = 15;
|
81 |
else
|
82 |
StSpawnApplication1->TimeOut = 0;
|
83 |
EnableControls(StSpawnApplication1->TimeOut == 0);
|
84 |
StSpawnApplication1->Execute();
|
85 |
}
|
86 |
}
|
87 |
//--------------------------------------------------------------------------- |