A
Alix88
Unregistered / Unconfirmed
GUEST, unregistred user!
因为若所有FORM压在一个项目中,占内存太大,我知道有个办法可以将非主FORM做成DLL
这样只有用到该FORM才调用,这样节约内存!
我这里有一个样板,但只能调用一个DLL,有什么方法调多个!
dllname='Pdll.dll';
procedure TForm1.Button1Click(Sender: TObject);
var
libah:thandle;
cGetDate:function(AHandle: THandle; ACaption: String):TDate; StdCall;
begin
libah:=LoadLibrary(dllname);
if libah=0 then
begin
showmessage('PDLL.dll 不存在');
exit;
end;
@cgetdate:=GetProcAddress(libah,'ShowFrm');
if @cgetdate<>nil then
edit1.Text:=DateToStr(cGetDate(Application.Handle, Caption))
else
showmessage('PDLL.dll 失败');
这样只有用到该FORM才调用,这样节约内存!
我这里有一个样板,但只能调用一个DLL,有什么方法调多个!
dllname='Pdll.dll';
procedure TForm1.Button1Click(Sender: TObject);
var
libah:thandle;
cGetDate:function(AHandle: THandle; ACaption: String):TDate; StdCall;
begin
libah:=LoadLibrary(dllname);
if libah=0 then
begin
showmessage('PDLL.dll 不存在');
exit;
end;
@cgetdate:=GetProcAddress(libah,'ShowFrm');
if @cgetdate<>nil then
edit1.Text:=DateToStr(cGetDate(Application.Handle, Caption))
else
showmessage('PDLL.dll 失败');