delphi做dll的问题 我是一个初学者.想知道dll是如何做的.而且我想知道具体的每一步操作.如:格式如何写,写完后如何才能进行编译,也就是说,我怎么才能看见我做的dll文件.请高手们不赐吝教,谢过. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 //转过来给你看看,以前我回答的//下面为DLLlibrary findCtrl;uses SysUtils, Classes, Unit1 in 'Unit1.pas';{$R *.res} exports GetString, FindCtrol;beginend.//DLL的单元unit Unit1;interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; function FindCtrol(handle: THandle): TWinControl; stdcall;implementationfunction FindCtrol(handle: THandle): TWinControl; stdcall;begin Result := FindControl(handle);end;end.//下面为调用DLLunit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TFindCtrol = function (handle: THandle): TWinControl; stdcall; TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end;var Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);var myFindCtrol: TFindCtrol; Ctrol: TWinControl; Hwd: Cardinal;begin Hwd := LoadLibrary(Pchar('F:\Dll\findCtrl.dll')); try if Hwd <> 0 then begin myFindCtrol := GetProcAddress(Hwd, Pchar('FindCtrol')); if @myFindCtrol <> nil then Ctrol := myFindCtrol(Button1.Handle); end; if Ctrol <> nil then ShowMessage(Ctrol.Name); finally if Hwd <> 0 then FreeLibrary(Hwd); end;end;end.//记住每个工程里面都得调用 vcl这个运行包. 把每个工程的 build with runtime packages 勾上就可以了. 这个是什么控件完成的?还是直接Canvas画图的? 把文件上传到数据库 如何判断数组数据记录重复! 如何用MediaPlayer使音乐自动循环播放? 打印image的问题? ★★★★怎么用FastReport实现 主-从-子从-子子从-子子子从....形式的报表?★★★★ select 我如何使mdichild稳藏起来? 现在好多程序都用插件来扩充程序功能。 插件 架构该如何设计呢? 小问题,小问题 delphi中判断数字的函数 怎样限制Edit为输入金额的专用输入框?
//下面为DLL
library findCtrl;
uses
SysUtils,
Classes,
Unit1 in 'Unit1.pas';{$R *.res}
exports
GetString,
FindCtrol;
begin
end.
//DLL的单元
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls; function FindCtrol(handle: THandle): TWinControl; stdcall;
implementationfunction FindCtrol(handle: THandle): TWinControl; stdcall;
begin
Result := FindControl(handle);
end;
end.//下面为调用DLL
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TFindCtrol = function (handle: THandle): TWinControl; stdcall;
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
var
myFindCtrol: TFindCtrol;
Ctrol: TWinControl;
Hwd: Cardinal;
begin
Hwd := LoadLibrary(Pchar('F:\Dll\findCtrl.dll'));
try
if Hwd <> 0 then
begin
myFindCtrol := GetProcAddress(Hwd, Pchar('FindCtrol'));
if @myFindCtrol <> nil then
Ctrol := myFindCtrol(Button1.Handle);
end;
if Ctrol <> nil then
ShowMessage(Ctrol.Name);
finally
if Hwd <> 0 then
FreeLibrary(Hwd);
end;
end;end.
//记住每个工程里面都得调用 vcl这个运行包. 把每个工程的 build with runtime packages 勾上就可以了.