function setid(a,b:pchar):pchar; stdcall;
begin
//a,b既是传入的参数员工编码,密码
//根据参数进行相应的查询验证
result:= pchar('姓名='+x+#13+'营业额'+y)
end;
exports
setid;
编译好的dll有两种方式调用,一种动态使用LoadLibrary,GetProcAddress等一系列函数;一种是写一个静态接口单元,如:
unit myinterface
interface
user windows,classes;
const
mydll = 'my.dll';
function setid(a,b:pchar):pchar; stdcall; external mydll;
implementation
end.
使用时,可以直接引用myinterface单元,调用setid方法;
调用:
var
vxy,x,y:pchar;
vlst:tstrings;
begin
vxy:= setid(a,b);
vlst:= tstringlist.create;
vlst.text:= vxy;
x:= vlst.values['姓名'];
y:= vlst.values['营业额'];
vlst.free;
end;
不明白的话发邮件吧,talent_ggy@126.com
你还不如直接问这个DLL怎么写呢!
function GetUandT(ID:integer;Password:Pchar):GetResult;stdcall;
begin
//这里是连接SQL和取姓名和营业额的代码,具体代码要看你的数据库表了
Result:= //结果这里是你的姓名 + 营业额
end;
exports
GetUandT; //这里是外部调用接口
APP程序调用DLL的时候有静态和动态之分
静态:
function GetUandT(ID:integer;Password:Pchar):GetResult;stdcall;external 'Project.DLL';
动态要使用LoadLibrary函数等....自己查下吧!
以上全手工打的,自己测试下,如果有错,请按错误提示改正一下!