while True do begin if not PeekMessage(msg,0,0,0,PM_REMOVE) then begin case MsgWaitForMultipleObjects(1,hCloseEvent,False,INFINITE,QS_ALLINPUT) of WAIT_OBJECT_0: Break;//hCloseEvent事件已经有效,故结束 WAIT_OBJECT_0+1:Continue;//消息队列中有消息存在 else Break;//其它情况,WM