1,183
社区成员
发帖
与我相关
我的任务
分享
procedure TThread.WndProc(var Message: TMessage);
begin
DefWindowProc(FWnd, Message.Msg, Message.WParam, Message.LParam);
end;
procedure TThread.Execute;
begin
{$IFDEF DELPHI_6_UP}
FWnd := Classes.AllocateHWnd(WndProc);
{$ELSE}
FWnd := AllocateHWnd(WndProc);
{$ENDIF}
try
while not Terminated do
begin
try
GetMessage(Msg, FWnd, 0, 0);
if //想要自己处理的消息
begin
//相关操作
end
else if not Terminated then
DispatchMessage(Msg);
except
end;
end;
finally
{$IFDEF DELPHI_6_UP}
Classes.DeallocateHWnd(FWnd);
{$ELSE}
DeallocateHWnd(FWnd);
{$ENDIF}
end;
end;
procedure TThread.Execute;
begin
while not Terminated do
begin
try
GetMessage(Msg, 0, 0, 0);
//根据 不同情况 ,做不同事情
except
end;
end;
end;