记性不好,留下点自己的成长,希望能够坚持下去。。。。
诚肯接受批评
1
{
这是DLL
}
2 library Project1;
3
4 uses
5 SysUtils,
6 Classes,
7 Dialogs;
8
9 procedure HelloWorld;
10 begin
11 MessageDlg( ' 厌恶了流浪的味道 ' , mtConfirmation, [mbOK], 0 );
12 end ;
13
14 exports
15 HelloWorld; { 这里很重要,在exe中调用时要用到,似乎大小写都不能错 }
16
17 { $R *.res }
18
19 begin
20 end .
21 //-----------------------------------------------------------------------------------------
22 { 这里是调用DLL的exe }
23 var
Form1 : TForm1;
procedure HelloWorld; external ' Test.dll ' ; { 通过过程调用DLL,Test.dll为生成的dll的名字,并且位置和exe文件在一个目录,不在的话,要指定 }
24 implementation
25
26 { $R *.dfm }
27
30 procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
31 Shift: TShiftState; X, Y: Integer);
32 begin
33 HelloWorld; { 执行dll中的程序代码,这里好像是和dll中exports语句对应的,大小写错了也不行哦 }
34 end ;
35
36 end .
2 library Project1;
3
4 uses
5 SysUtils,
6 Classes,
7 Dialogs;
8
9 procedure HelloWorld;
10 begin
11 MessageDlg( ' 厌恶了流浪的味道 ' , mtConfirmation, [mbOK], 0 );
12 end ;
13
14 exports
15 HelloWorld; { 这里很重要,在exe中调用时要用到,似乎大小写都不能错 }
16
17 { $R *.res }
18
19 begin
20 end .
21 //-----------------------------------------------------------------------------------------
22 { 这里是调用DLL的exe }
23 var
Form1 : TForm1;
procedure HelloWorld; external ' Test.dll ' ; { 通过过程调用DLL,Test.dll为生成的dll的名字,并且位置和exe文件在一个目录,不在的话,要指定 }
24 implementation
25
26 { $R *.dfm }
27
30 procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
31 Shift: TShiftState; X, Y: Integer);
32 begin
33 HelloWorld; { 执行dll中的程序代码,这里好像是和dll中exports语句对应的,大小写错了也不行哦 }
34 end ;
35
36 end .