procedure TFrMain.N13Click(Sender: TObject);
var
DLLHandle: THandle;
DLLSub: InvokeDLLForm;
begin
DLLHandle := LoadLibrary('carinfodll.dll');
if DLLHandle <> 0 then
begin
@DLLSub := GetProcAddress(DLLHandle, 'CreateCarInfoDLL');
if Assigned(DLLSub) then
begin
CarInfoForm := DLLSub(Frmain.con, Application, Screen);
end;
end;
end;
function CreateCarInfoDLL(con:TADOConnection; App: TApplication; Scr: TScreen):TForm;
begin
Application := App;
Screen := Scr;
condll:=con;
if not assigned(Frcarinfo) then
Application.CreateForm(TFrcarinfo, Frcarinfo); //创建一个Frcarinfo的窗体
result:=frcarinfo;
end;
procedure ExitDLL(Reason: Integer);
begin
if Reason = DLL_PROCESS_DETACH then
begin
Application := DLLApp;
Screen := DLLScr;
Frcarinfo:=Nil;
end;
end;