library auther;
uses
SysUtils;
function GetCompany(s: PChar): PChar;
stdcall;
begin
if s='name' then
Result:='锐信管理系统'
else
if s='address' then
Result:='丰泽区XX大厦'
else
if s='englishname' then
Result:='Quanzhong company'
else
Result:='';
end;
Exports
GetCompany;
begin
end.
--------------
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function GetCompany(S: PChar): PChar;
stdcall;
external 'auther.dll' name 'GetCompany';
procedure TForm1.Button1Click(Sender: TObject);
begin
Label1.Caption:=GetCompany('name');
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Label1.Caption:=getcompany('name');
Label2.Caption:=getcompany('address');
Label3.Caption:=getcompany('englishname');
end;
end.