创建和调用DLL的Delphi代码

Dll里中的代码 

library RegDll;
uses
SysUtils,
Classes,
Windows,
Registry; // 没 Windows 注册表里查找不到 HKEY_LOCAL_MACHIN Registry为注册表操作 

{$R *.res} 

Function 函数名 (变量: String):String; StdCall; // 注册表查询获得AE软件所有版本返回字符串列表
begin
  result := '字符'; 
end;

exports 函数名;//输出函数 
begin
end. 

Inno SetUp 里调用代码
function 函数名(变量:String):TStringList;external'函数名@DLL的地址 stdcall delayload'; //注意这个DLL地址为临时文件夹的地址:先需要在【FILE】段把DLL复制到临时文件夹中 

EXE里调用代码
//函数一定注意大小写

unit 单元名; 

interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,Dialogs, StdCtrls;

type

TForm1 = class(TForm)
Button1: TButton;

procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end; 
var
Form1: TForm1; 
implementation

{$R *.dfm}
function 函数名(变量:String):TString;StdCall;external'Dll的地址'; //调用外部的DLL
procedure TForm1.Button1Click(Sender: TObject);
begin
  ShowMessage(函数);
end; 

end.
上一篇:Ubuntu16.04上添加用户以及修改用户所属的组


下一篇:Ubuntu16.04开启root用户,并远程登录