1. Dynamic Call DLL
UnitFormMain;InterfaceusesWindows, Messages, sysutils, variants, Classes, Graphics, Controls, Forms, Dialogs, Stdctrls;typeTfrmmain=class(tform) Btnloadlibrary:tbutton; procedureBtnloadlibraryclick (Sender:tobject); Private {Private Declarations} Public procedureLoaddllz; End; Tfnc_execjs=function(_psvgfrm:P ointer; _pcjs:P char): integer;stdcall; Tfnd_passstid=function(_sender:P ointer; _pcstid:P char): integer;stdcall;varFrmmain:tfrmmain;// ***G_fnexecjs:tfnc_execjs; G_fnpassstid:tfnd_passstid;Implementation{$R *.DFM}{Tfrmmain}procedureTfrmmain.loaddllz;varhdll:cardinal; Irtn:integer;beginhDLL:= LoadLibrary (PChar ('DrRemoteCall.dll')); ifhDLL =0 Then beginExit; End; @g_fnExecJS:= GetProcAddress (hDLL,'Execjs'); @g_fnPassStId:= GetProcAddress (hDLL,'Passstid'); if notAssigned (G_FNEXECJS) Then beginFreeLibrary (hDLL); Exit; End; if notAssigned (G_fnpassstid) Then beginFreeLibrary (hDLL); Exit; End; //ZC: Calling FunctionsIrtn: = G_fnexecjs (Nil,'TESTCC'); FreeLibrary (hDLL); ShowMessage (' out');End;procedureTfrmmain.btnloadlibraryclick (sender:tobject);beginLoaddllz;End;End.
2.
3.
4.
5.
Dll_delphi Dynamic Invocation