B
baseyueliang
Unregistered / Unconfirmed
GUEST, unregistred user!
新建一个dll工程:
----------------
library dll;
uses
Classes;
{$R *.res}
begin
TThread.Create(True).Free;
end.
-----------
然后做一个客户端,普通的Exe工程,加入一个Form:
-----------
unit Unit1;
interface
uses
Windows, Classes, Forms, StdCtrls, Controls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
FreeLibrary(LoadLibrary('dll.dll'));
end;
end.
-----------------
按钮按下,即死机,Cpu100%,为何?然而,线程在dll的标准方法中而非初始化代码中可以正常释放.
----------------
library dll;
uses
Classes;
{$R *.res}
begin
TThread.Create(True).Free;
end.
-----------
然后做一个客户端,普通的Exe工程,加入一个Form:
-----------
unit Unit1;
interface
uses
Windows, Classes, Forms, StdCtrls, Controls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
FreeLibrary(LoadLibrary('dll.dll'));
end;
end.
-----------------
按钮按下,即死机,Cpu100%,为何?然而,线程在dll的标准方法中而非初始化代码中可以正常释放.