| 1 | unit fXWBAppHandle1;
 | 
|---|
| 2 | 
 | 
|---|
| 3 | interface
 | 
|---|
| 4 | 
 | 
|---|
| 5 | uses
 | 
|---|
| 6 |   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
 | 
|---|
| 7 |   StdCtrls, RpcSlogin, Trpcb, RpcConf1, frmVistAAbout, Menus,
 | 
|---|
| 8 |   SharedRPCBroker;
 | 
|---|
| 9 | 
 | 
|---|
| 10 | type
 | 
|---|
| 11 |   TForm1 = class(TForm)
 | 
|---|
| 12 |     btnConnect: TButton;
 | 
|---|
| 13 |     btnStartApp2: TButton;
 | 
|---|
| 14 |     edtOtherProgram: TEdit;
 | 
|---|
| 15 |     lblOtherProgram: TLabel;
 | 
|---|
| 16 |     lblOptional: TLabel;
 | 
|---|
| 17 |     lblWithFull: TLabel;
 | 
|---|
| 18 |     Memo1: TMemo;
 | 
|---|
| 19 |     btnExit: TButton;
 | 
|---|
| 20 |     MainMenu1: TMainMenu;
 | 
|---|
| 21 |     File1: TMenuItem;
 | 
|---|
| 22 |     Exit1: TMenuItem;
 | 
|---|
| 23 |     Help1: TMenuItem;
 | 
|---|
| 24 |     About1: TMenuItem;
 | 
|---|
| 25 |     brkrRPCB: TSharedRPCBroker;
 | 
|---|
| 26 |     procedure btnConnectClick(Sender: TObject);
 | 
|---|
| 27 |     procedure btnStartApp2Click(Sender: TObject);
 | 
|---|
| 28 |     procedure btnExitClick(Sender: TObject);
 | 
|---|
| 29 |     procedure Exit1Click(Sender: TObject);
 | 
|---|
| 30 |     procedure About1Click(Sender: TObject);
 | 
|---|
| 31 |   private
 | 
|---|
| 32 |     { Private declarations }
 | 
|---|
| 33 |   public
 | 
|---|
| 34 |     { Public declarations }
 | 
|---|
| 35 |   end;
 | 
|---|
| 36 | 
 | 
|---|
| 37 | var
 | 
|---|
| 38 |   Form1: TForm1;
 | 
|---|
| 39 | 
 | 
|---|
| 40 | implementation
 | 
|---|
| 41 | 
 | 
|---|
| 42 | {$R *.DFM}
 | 
|---|
| 43 | 
 | 
|---|
| 44 | 
 | 
|---|
| 45 | procedure TForm1.btnConnectClick(Sender: TObject);
 | 
|---|
| 46 | var
 | 
|---|
| 47 |   Server, Port: String;
 | 
|---|
| 48 | begin
 | 
|---|
| 49 |   if btnConnect.Caption = '&Connect' then
 | 
|---|
| 50 |   begin
 | 
|---|
| 51 |     GetServerInfo(Server, Port);
 | 
|---|
| 52 |     brkrRPCB.Server := Server;
 | 
|---|
| 53 |     brkrRPCB.ListenerPort := StrToInt(Port);
 | 
|---|
| 54 |     brkrRPCB.Connected := True;
 | 
|---|
| 55 |     if brkrRPCB.Connected then
 | 
|---|
| 56 |       btnConnect.Caption := '&Disconnect';
 | 
|---|
| 57 |   end
 | 
|---|
| 58 |   else
 | 
|---|
| 59 |   begin
 | 
|---|
| 60 |     brkrRPCB.Connected := False;
 | 
|---|
| 61 |     btnConnect.Caption := '&Connect';
 | 
|---|
| 62 |   end;
 | 
|---|
| 63 | end;
 | 
|---|
| 64 | 
 | 
|---|
| 65 | procedure TForm1.btnStartApp2Click(Sender: TObject);
 | 
|---|
| 66 | var
 | 
|---|
| 67 |   CurDir: String;
 | 
|---|
| 68 | begin
 | 
|---|
| 69 |   if edtOtherProgram.Text <> '' then
 | 
|---|
| 70 |   begin
 | 
|---|
| 71 |     CurDir := edtOtherProgram.Text;
 | 
|---|
| 72 |     StartProgSLogin(CurDir,nil);
 | 
|---|
| 73 |   end
 | 
|---|
| 74 |   else
 | 
|---|
| 75 |   begin
 | 
|---|
| 76 |     { Use Test2.exe and expecting it to be in the startup directory for the current application}
 | 
|---|
| 77 |     CurDir := ExtractFilePath(ParamStr(0)) + 'XWBAppHandle2.exe';
 | 
|---|
| 78 | 
 | 
|---|
| 79 |     { Now start application with silent login }
 | 
|---|
| 80 |     StartProgSLogin(CurDir, brkrRPCB);
 | 
|---|
| 81 |   end;
 | 
|---|
| 82 | end;
 | 
|---|
| 83 | 
 | 
|---|
| 84 | procedure TForm1.btnExitClick(Sender: TObject);
 | 
|---|
| 85 | begin
 | 
|---|
| 86 |   halt;
 | 
|---|
| 87 | end;
 | 
|---|
| 88 | 
 | 
|---|
| 89 | procedure TForm1.Exit1Click(Sender: TObject);
 | 
|---|
| 90 | begin
 | 
|---|
| 91 |   Halt;
 | 
|---|
| 92 | end;
 | 
|---|
| 93 | 
 | 
|---|
| 94 | procedure TForm1.About1Click(Sender: TObject);
 | 
|---|
| 95 | begin
 | 
|---|
| 96 |   ShowAboutBox;
 | 
|---|
| 97 | end;
 | 
|---|
| 98 | 
 | 
|---|
| 99 | end.
 | 
|---|