线程的问题 ( 积分: 10 )

  • 主题发起人 主题发起人 windowboy
  • 开始时间 开始时间
W

windowboy

Unregistered / Unconfirmed
GUEST, unregistred user!
小弟刚接触到线程,那位大哥能不能告诉我那里有资料下载,或发些资料给我啊!!
谢谢了!小弟分不多,但是只有是谢谢!!
 
小弟刚接触到线程,那位大哥能不能告诉我那里有资料下载,或发些资料给我啊!!
谢谢了!小弟分不多,但是只有是谢谢!!
 
看delphi自带的例子
.../Borland/Delphi5/Demos/Threads
 
unit Unitxx;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
Const WM_MyMSG=WM_USER+1003;
type
my = class(TThread)
private
{ Private declarations }
protected
procedure Execute;
override;

end;

type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
procedure onmymsg(var message:TMessage);message WM_MyMSG;

public
{ Public declarations }
end;

var
Form1: TForm1;
var
m1:dword;

implementation
{$R *.dfm}
procedure TForm1.onmymsg(var message: TMessage);
begin
showmessage('123');
end;

procedure TForm1.Button1Click(Sender: TObject);
var m:my;
begin

m:=my.Create(false);
m.FreeOnTerminate:=true;
sendmessage(m1,WM_MyMSG,0,0);
end;

{ my }
procedure my.Execute;
begin
inherited;
sendmessage(form1.Handle,WM_MyMSG,0,0);

end;


end.

//贴代码了事
 
你把Delphi的TThread定义看一下,就明白了。
跟操作系统里讲的线程是一样的。
 
多人接受答案了。
 
后退
顶部