用动态调用的方法
代码如下:
type
Fmryt=function(app:Tapplication;ico:Ticon;ct:string;inf:string):string;stdcall;
procedure Tax_form_main.FormShow(Sender: TObject);
var
myyhdl:Fyhdl;
dllhandle:Thandle;
user:string;
begin
user:='';
dllhandle:=loadlibrary('dljm.dll');
if dllhandle<>0 then
begin
///////////////////////////////////
//这里是你要的部分
//////////////////////////////////
@myyhdl := GetProcAddress(DLLHandle, 'yhdl');
///////////////////////////////////
///////////////////////////////////
if Assigned(myyhdl) then
begin
try
if soap1.Checked then
user:=myyhdl(application,SoapConnection1,nil,'');
if ado1.Checked then
user:=myyhdl(application,nil,adoconnection1,'');
except
messagebox(application.Handle,'无法调用程序运行所需的函数!','运行错误',mb_ok+mb_iconerror);
freelibrary(dllhandle);
application.Terminate
end;
end
else
begin
messagebox(application.Handle,'无法加载程序运行所需的函数!','运行错误',mb_ok+mb_iconerror);
freelibrary(dllhandle);
application.Terminate;
end;
end
else
begin
messagebox(application.Handle,'无法加载程序运行所需的文件!','运行错误',mb_ok+mb_iconerror);
freelibrary(dllhandle);
application.Terminate;
end;
if user='' then
begin
//messagebox(application.Handle,'用户登陆失败!请确认您的用户名和密码。','登录失败',mb_ok+mb_iconerror);
application.Terminate;
end
else
begin
//这里需要加入权限判断的代码
end;
hold:=true;
panel1.Visible :=true;
tim_hide.Enabled :=false;
sbt_hide.Enabled :=false;
sbt_hold.Glyph:= img_hold.Picture.Bitmap ;
pl_sp.Visible :=false;
if strtobool(mryt_inf.Strings[1]) then
n5.Click;
end;