-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMyDLL.dpr
More file actions
115 lines (99 loc) · 2.35 KB
/
Copy pathMyDLL.dpr
File metadata and controls
115 lines (99 loc) · 2.35 KB
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
library MyDLL;
uses
SysUtils,
Classes,
variants,
Windows,
Dialogs,
Forms,
ActiveX,
ComObj,
ExtCtrls,
unit3,
Controls,
IniFiles,
UForm in 'UForm.pas' {FrmTest};
{$R *.res}
type
TMyObject = Class(TObject)
private
FData: OleVariant;
FSoftOne: OleVariant;
FTimer: TTimer;
FMemIni : TMemIniFile;
FSections: TStrings;
procedure OnTimerEvent(ASender:TObject);
public
constructor Create(AObject: OleVariant);
destructor Destroy; override;
end;
var
FMyObject: TMyObject;
{ TMyObject }
constructor TMyObject.Create(AObject: OleVariant);
var
ASQL: string;
k: integer;
Strs:TStrings;
begin
inherited Create;
FSoftOne:= AObject;
FTimer:= TTimer.Create(nil);
FTimer.Interval:= 15000;
FTimer.OnTimer := OnTimerEvent;
FTimer.Enabled:= True;
FData := FSoftOne.GETSQLDATASET('Select CODE, NAME FROM TRDR WHERE SODTYPE=13',null);
ShowMessage('Demon Started! Hello!!');
end;
destructor TMyObject.Destroy;
begin
inherited;
end;
procedure TMyObject.OnTimerEvent(ASender: TObject);
begin
ShowMessage('Hello from DLL');
end;
function CustPost(UserPointer:Pointer; const UserData:OleVariant):OleVariant; stdcall;
var
CustTable: OleVariant;
s: string;
begin
ShowMessage(Format('List=%s, Form=%s',[UserData.LIST, UserData.FORM]));
CustTable:= UserData.FINDTABLE('CUSTOMER');
s:=TForm1.Open(CustTable.Code, CustTable.Name, CustTable.EMail);
if s<>'' then
begin
CustTable.edit;
CustTable.Remarks:=CustTable.Remarks+' '+s;
end else UserData.EXCEPTION('S T O P !');
end;
function Initialize(Mode: integer; const ObjectName:OleVariant; const ObjectIntf:OleVariant; var UserPointer:Pointer):OleVariant; stdcall;
begin
case mode of
0: begin
Result:='CUSTOMER';
if Assigned(FMyObject) then FMyObject.Free;
FMyObject:= TMyObject.Create(ObjectIntf);
end;
1 : if SameText(ObjectName,'CUSTOMER') then
begin
Result:= ObjectIntf;
ObjectIntf.AddMethod('ON_POST', Integer(@CustPost));
end;
2: if SameText(ObjectName,'CUSTOMER') then
begin
end;
end; { case }
end;
function InitForm(Handle:integer; const ObjIntf:Variant):integer; stdcall;
var AFrm: TFrmTest;
begin
AFrm:= TFrmTest.Create2(nil, Handle, ObjIntf);
Result:= AFrm.Handle;
AFrm.Visible:=True;
end;
exports
Initialize,
InitForm;
begin
end.