source: cprs/trunk/BDK32/Samples/SharedRPCBroker/SilentSignOn/fXWBAppHandle2.pas@ 1535

Last change on this file since 1535 was 829, checked in by Kevin Toppenberg, 14 years ago

Upgrade to version 27

File size: 2.4 KB
RevLine 
[829]1unit fXWBAppHandle2;
2
3interface
4
5uses
6 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
7 StdCtrls, Trpcb, RpcSLogin, RpcConf1, frmVistAAbout, Menus,
8 SharedRPCBroker;
9
10type
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
39var
40 Form1: TForm1;
41 Login: TVistaLogin;
42
43implementation
44
45{$R *.DFM}
46
47
48
49procedure TForm1.FormCreate(Sender: TObject);
50var
51 NChars: Cardinal;
52 NameBuffer: PChar;
53 Server, Port: String;
54begin
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';
84end;
85
86
87procedure TForm1.btnCloseClick(Sender: TObject);
88begin
89 halt;
90end;
91
92procedure TForm1.Exit1Click(Sender: TObject);
93begin
94 Halt;
95end;
96
97procedure TForm1.About2Click(Sender: TObject);
98begin
99 ShowAboutBox;
100end;
101
102end.
Note: See TracBrowser for help on using the repository browser.