-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUMyExternal.pas
133 lines (108 loc) · 3.94 KB
/
UMyExternal.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
{$A8,B-,C+,D+,E-,F-,G+,H+,I+,J-,K-,L+,M-,N+,O+,P+,Q-,R-,S-,T-,U-,V+,W-,X+,Y+,Z1}
{$WARN UNSAFE_TYPE OFF}
unit UMyExternal;
interface
uses
Forms, ActiveX, Classes, ComObj, NetFavorites_TLB, Dialogs, ShlObj, HttpApp,
Controls;
type
TMyExternal = class(TAutoIntfObject, IMyExternal, IDispatch)
private
//fData: TStringList; //info from data file
protected
procedure OpenSyncFrame; safecall;
procedure OpenFrame(const URL: WideString; Target: SYSINT; Width: SYSINT; Height: SYSINT;
const Title: WideString); safecall;
procedure UserLoginSuccess(const URL: WideString; Weight: SYSINT; Height: SYSINT); safecall;
procedure ToLoginPage(const URL: WideString; Weight: SYSINT; Height: SYSINT); safecall;
procedure OpenMessageFrame(const URL: WideString; Weight: SYSINT; Height: SYSINT;
const Title: WideString); safecall;
procedure Logouted; safecall;
procedure Redirect(const ToUrl: WideString); safecall;
public
constructor Create;
destructor Destroy; override;
{ IMyExternal methods }
end;
implementation
uses
SysUtils, StdActns, FunctionCommon, FormMain, SystemConfig;
{ TMyExternal }
{*******************************************************************************}
constructor TMyExternal.Create;
var
TypeLib: ITypeLib; // type library information
ExeName: WideString; // name of our program's exe file
begin
// Get name of application
ExeName := ParamStr(0);
// Load type library from application's resources
OleCheck(LoadTypeLib(PWideChar(ExeName), TypeLib));
// Call inherited constructor
inherited Create(TypeLib, IMyExternal);
// Create and load string list from file
//fData := TStringList.Create;
//fData.LoadFromFile(ChangeFileExt(ExeName, '.dat'));
end;
{*******************************************************************************}
destructor TMyExternal.Destroy;
begin
//fData.Free;
inherited;
end;
{*******************************************************************************}
procedure TMyExternal.Logouted;
begin
//注销External调用
GBL_IS_LOGIN:= False;
if GBL_IS_EXIT = False then CloseFormMain;
end;
{*******************************************************************************}
procedure TMyExternal.OpenFrame(const URL: WideString; Target, Width,
Height: SYSINT; const Title: WideString);
begin
DebugTrace('External调用','OpenFrame');
DEF_INFO_FRAME[0].Url:=URL;
DEF_INFO_FRAME[0].Target:= Target;
DEF_INFO_FRAME[0].Width:= Width;
DEF_INFO_FRAME[0].Height:= Height+70;
DEF_INFO_FRAME[0].Title:= Title;
ShowFormOpenFrame;
end;
{*******************************************************************************}
procedure TMyExternal.OpenMessageFrame(const URL: WideString; Weight,
Height: SYSINT; const Title: WideString);
begin
DebugTrace('External调用','OpenMessageFrame');
ShowFormMessageBox;
end;
{*******************************************************************************}
procedure TMyExternal.OpenSyncFrame;
begin
ShowFormSyncImport;
end;
{*******************************************************************************}
procedure TMyExternal.Redirect(const ToUrl: WideString);
begin
DebugTrace('External调用','Redirect');
frmMain.wbBase.Navigate(ToUrl);
end;
{*******************************************************************************}
procedure TMyExternal.ToLoginPage(const URL: WideString; Weight,
Height: SYSINT);
begin
GBL_IS_LOGIN:=False;
end;
{*******************************************************************************}
procedure TMyExternal.UserLoginSuccess(const URL: WideString; Weight,
Height: SYSINT);
begin
//跳转到主窗体
GBL_IS_LOGIN:=True;
USER_ID:= StrToInt(GetCurrenPCIECookie(DEF_URL_HOST, 'UserID'));
USER_NAME:= HTTPDecode(GetCurrenPCIECookie(DEF_URL_HOST, 'UserName'));
USER_LOGIN_KEY := GetCurrenPCIECookie(DEF_URL_HOST, 'LoginKey');
CloseFormLogin;
end;
{*******************************************************************************}
end.