end;
function TMainForm.LoadDll(DllPath, DllFunc: string): Boolean;
type
TIntFunc = function(App: TApplication; Parent:THandle):THandle; stdcall;
var
Th: THandle;
Tf: TIntFunc;
Tp: TFarProc;
begin
result := true;
Th := LoadLibrary(pchar(DllPath)); {装载DLL}
if Th > 0 then
try
Tp := GetProcAddress(Th, pchar(DllFunc));
if Tp <> nil then
begin
Tf := TIntFunc(Tp);
//Tf(application.Handle, application.Icon.Handle); {调用函数}//20100331
tf(Application, TabSheet1.Handle);
end
else application.MessageBox('函数没有找到', '提示');
finally
FreeLibrary(Th); {释放DLL}
end
else
application.MessageBox('DLL没有找到', '提示');
end;
dll form 的圖標問題,很多資料上說隻要把mainForm的application.handle傳進去給dll的applicaton就可以了
試了還是不可以,還要加icon的handle才可以
Application.Handle := App.Handle;
Application.Icon.Handle := App.Icon.Handle;