[476] | 1 | unit fXWBAppHandle2;
|
---|
| 2 |
|
---|
| 3 | interface
|
---|
| 4 |
|
---|
| 5 | uses
|
---|
| 6 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
---|
| 7 | StdCtrls, Trpcb, RpcSLogin, RpcConf1, frmVistAAbout, Menus,
|
---|
| 8 | SharedRPCBroker;
|
---|
| 9 |
|
---|
| 10 | type
|
---|
| 11 | TForm1 = class(TForm)
|
---|
| 12 | edtDuz: TEdit;
|
---|
| 13 | edtName: TEdit;
|
---|
| 14 | edtDTime: TEdit;
|
---|
| 15 | edtUserName: TEdit;
|
---|
| 16 | btnClose: TButton;
|
---|
| 17 | edtDivision: TEdit;
|
---|
| 18 | lblDUZ: TLabel;
|
---|
| 19 | lblName: TLabel;
|
---|
| 20 | lblDTime: TLabel;
|
---|
| 21 | lblDivision: TLabel;
|
---|
| 22 | lblUserName: TLabel;
|
---|
| 23 | MainMenu1: TMainMenu;
|
---|
| 24 | File1: TMenuItem;
|
---|
| 25 | Exit1: TMenuItem;
|
---|
| 26 | About1: TMenuItem;
|
---|
| 27 | About2: TMenuItem;
|
---|
| 28 | brkrRPCB: TSharedRPCBroker;
|
---|
| 29 | procedure FormCreate(Sender: TObject);
|
---|
| 30 | procedure btnCloseClick(Sender: TObject);
|
---|
| 31 | procedure Exit1Click(Sender: TObject);
|
---|
| 32 | procedure About2Click(Sender: TObject);
|
---|
| 33 | private
|
---|
| 34 | { Private declarations }
|
---|
| 35 | public
|
---|
| 36 | { Public declarations }
|
---|
| 37 | end;
|
---|
| 38 |
|
---|
| 39 | var
|
---|
| 40 | Form1: TForm1;
|
---|
| 41 | Login: TVistaLogin;
|
---|
| 42 |
|
---|
| 43 | implementation
|
---|
| 44 |
|
---|
| 45 | {$R *.DFM}
|
---|
| 46 |
|
---|
| 47 |
|
---|
| 48 |
|
---|
| 49 | procedure TForm1.FormCreate(Sender: TObject);
|
---|
| 50 | var
|
---|
| 51 | NChars: Cardinal;
|
---|
| 52 | NameBuffer: PChar;
|
---|
| 53 | Server, Port: String;
|
---|
| 54 | begin
|
---|
| 55 | { check for silent login data on command line }
|
---|
| 56 | if not CheckCmdLine(brkrRPCB) then
|
---|
| 57 | begin // Couldn't log on via command line give choice
|
---|
| 58 | if Application.MessageBox('Can''t connect by command line arguments, do you want to connect anyway?','Silent Connection Error', MB_OKCANCEL + MB_DEFBUTTON1) = IDOK then
|
---|
| 59 | begin
|
---|
| 60 | GetServerInfo(Server, Port);
|
---|
| 61 | brkrRPCB.Server := Server;
|
---|
| 62 | brkrRPCB.ListenerPort := StrToInt(Port);
|
---|
| 63 | Caption := 'XWBAppHandle2 - Started by normal sign-on'
|
---|
| 64 | end
|
---|
| 65 | else
|
---|
| 66 | halt;
|
---|
| 67 | end;
|
---|
| 68 |
|
---|
| 69 | { Get and display information on logged in user }
|
---|
| 70 | GetUserInfo(brkrRPCB);
|
---|
| 71 | edtDUZ.Text := brkrRPCB.User.DUZ;
|
---|
| 72 | edtName.Text := brkrRPCB.User.Name;
|
---|
| 73 | edtDTime.Text := brkrRPCB.User.DTime;
|
---|
| 74 | edtDivision.Text := brkrRPCB.User.Division;
|
---|
| 75 |
|
---|
| 76 | {also show local username }
|
---|
| 77 | NChars := 0;
|
---|
| 78 | GetUserName(nil,NChars);
|
---|
| 79 | NameBuffer := StrAlloc(NChars);
|
---|
| 80 | if GetUserName(NameBuffer, NChars) then
|
---|
| 81 | edtUserName.Text := NameBuffer
|
---|
| 82 | else
|
---|
| 83 | edtUserName.Text := 'Can''t get name';
|
---|
| 84 | end;
|
---|
| 85 |
|
---|
| 86 |
|
---|
| 87 | procedure TForm1.btnCloseClick(Sender: TObject);
|
---|
| 88 | begin
|
---|
| 89 | halt;
|
---|
| 90 | end;
|
---|
| 91 |
|
---|
| 92 | procedure TForm1.Exit1Click(Sender: TObject);
|
---|
| 93 | begin
|
---|
| 94 | Halt;
|
---|
| 95 | end;
|
---|
| 96 |
|
---|
| 97 | procedure TForm1.About2Click(Sender: TObject);
|
---|
| 98 | begin
|
---|
| 99 | ShowAboutBox;
|
---|
| 100 | end;
|
---|
| 101 |
|
---|
| 102 | end.
|
---|