WaitForSingleObject时窗体死了解决方案

WaitForSingleObject时窗体死了
大家好,请大家帮忙看看是什么问题。
同一个窗体上有两个按钮button1与button2,现在要在button1的click事件中
要等待button2的click事件,代码如下
button1:
Delphi(Pascal) code

procedure TForm1.Button1Click(Sender: TObject);
.
.
.
Handle := CreateEvent(nil,False,True,nil);
.
.
.
ReSetEvent(Handle);
WaitForSingleObject(Handle,INFINITE);


button2:
Delphi(Pascal) code

procedure TForm1.Button2Click(Sender: TObject);
begin
.
.
.
SetEvent(Handle);
end;



但是程序到了WaitForSingleObject(Handle,INFINITE);这里就死掉了,请问我该如何做?
谢谢

------解决方案--------------------
Delphi(Pascal) code
procedure TForm1.Button1Click(Sender: TObject);
.
.
.
Handle := CreateEvent(nil,False,True,nil);
.
.
.
ReSetEvent(Handle);
//WaitForSingleObject(Handle,INFINITE);
//>>
while WaitForSingleObject(Handle,0) = WAIT_TIMEOUT do 
  Application.ProcessMessage;
//<<

------解决方案--------------------
不是有timeout吗?你wait几个ms,timeout后表明现象没有出现,循环一下就可以了。