首页 > 编程语言 > 详细

给线程发送消息让它执行不同的处理

时间:2015-01-29 14:06:13      阅读:248      评论:0      收藏:0      [点我收藏+]

unit Unit2;

interface

uses
System.Classes, Windows, Messages;

const
WM_DO = WM_USER + 1;

type
TDemoThread = class(TThread)
private
{ Private declarations }
protected
procedure Execute; override;
end;

implementation

{ TDemoThread }

procedure TDemoThread.Execute;
var
Msg: TMsg;
begin
{ Place thread code here }
while GetMessage(Msg, 0, 0, 0) do
begin
case Msg.message of
WM_DO:
; // do it
WM_CLOSE:
Break;
end;
Sleep(100);
end;

end;

给线程发送消息让它执行不同的处理

原文:http://www.cnblogs.com/hnxxcxg/p/4259407.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!