实例:
hpp:
typedef int (*MYPROC1)(AnsiString Ser);
cpp:
void __fastcall TMainform:
LL_About(void)
{
HINSTANCE Hinstlib;
MYPROC1 DLL_ab;
Hinstlib=LoadLibrary("delapp.dll");
//调用Delphi的DLL
DLL_ab=(MYPROC1)GetProcAddress(Hinstlib,"DLL1");
DLL_ab(Q_Ver);
FreeLibrary(Hinstlib);
}
pas:
library Sdelcom;
uses
SysUtils,
Classes,
About in 'About.pas' {AboutForm};
Exports
DLL_about name 'DLL1';
begin
end.
Function DLL_about(Ver :String): Integer;stdcall;
implementation
{$R *.DFM}
procedure TAboutForm.FormCreate(Sender: TObject);
var
LibHandle : THandle;
begin
LibHandle:=LoadLibrary(Pchar('sres'));
//Delphi调用资源DLL
Image2.Picture.Bitmap.LoadFromResourceID(LibHandle,1);
FreeLibrary(LibHandle);
end;
Function DLL_about(Ver :String): Integer;stdcall;
begin
AboutForm:= TAboutForm.Create(Application);
AboutForm.Label2.Caption:=Ver;
AboutForm.ShowModal;
Result:=1;
end;
调用Delphi做的函数,About窗,类.