要想自动消失关键要将本程序置于顶端,用SetForegroundWindow(Handle):<br>procedure TMainForm.ServerCallBack(var Message:TMessage);<br>Var P:TPoint;<br>begin<br> if (Message.LParam=WM_LBUTTONDBLCLK) then<br> begin<br> if (Message.WParam=IDI_Server) then<br> begin<br> MainForm.show;<br> end;<br> end;<br> if (Message.LParam=WM_RBUTTONDOWN) then<br> begin<br> if (Message.WParam=IDI_Server) then<br> begin<br> if not Visible then<br> begin<br> SetForegroundWindow(Handle);<br> GetCursorPos(p);<br> PopupMenu.Popup(p.x, p.y);<br> end else<br> SetForegroundWindow(Handle);<br> end;<br> end;<br>end;