Home > Back-end >  Refer to the writing of dynamic link library
Refer to the writing of dynamic link library

Time:09-25

There is now a ocx component, there are two functions of real-time events, assuming that there is written like this:
AAA_TLB. Pas
.
_EBCH_CommStdEvents=dispinterface
[' {BBA0C151 - D567-4980-8 b142e24e6 DFF - 547} ']
Procedure Method1 (var param: WideString); Dispid 1;
Procedure an (var param: WideString); Dispid 2;
end;
TM_ComStdMethod1=procedure (ASender: TObject; Var param: WideString) of the object;
TM_ComStdMethod2=procedure (ASender: TObject; Var param: WideString) of the object;
TM_ComStd=class (TOleControl)
.
Now, I need to write a DLL file to capture it, advice on how to write?
The DPR
The library of ABC;
USES AAA_TLB;
.
Exports

End.
Online, etc., sincerely for advice,

CodePudding user response:

Great god to answer quickly ah, help me to fix the problem, send you a big red envelopes, plus Q

CodePudding user response:

 
The library of ABC;

USES AAA_TLB, Windows, SysUtils, Forms, Classes, activex, Messages, Variants, Graphics, Controls,
Dialogs, OleCtrls StdCtrls;

Type
WEDLL=class
STM_ComStd1: TM_ComStd;
The constructor the Create ();
Procedure STM_ComStd1Method1 (ASender: TObject; Var param: WideString);//ocx in fact here is like this?
Procedure STM_ComStd1Method2 (ASender: TObject; Var param: WideString);//ocx in fact here is like this?
Private
Protected
Public
end;

The constructor WEDLL. Create;
The begin
STM_ComStd1:=TM_ComStd. Create (nil);
end;

Procedure WEDLL. STM_ComStd1Method1 (ASender: TObject; Var param: WideString);
The begin
Writeln (param);//there is no
end;

Procedure WEDLL. STM_ComStd1Method2 (ASender: TObject; Var param: WideString);
The begin
Writeln (param);//there is no
end;

Var
Wedll1: WEDLL;
Sign: Boolean=false;

Procedure createobj ();
The begin
If not (sign) then
The begin
Wedll1:=WEDLL. Create;
Sign:=True;
end;
end;

The function the run () : JInt; {$IFDEF WIN32} stdcall; {$ENDIF} {$IFDEF LINUX} cdecl; {$ENDIF}
The begin
Createobj ();
end;

Exports
run;
End.

I above this code execution after the run that method1 and method is supposed to listen to the event, why not? Ain't that familiar because of Delphi, hope everybody a great god help ah,

CodePudding user response:

STM_ComStd1. Method1:=STM_ComStd1Method1 wrote in the create method
  • Related