VCL Delphi

Title: Close / Hide a TPopupMenu?
{---------------------------------------------------------------------
This code shows how to hide a TPopupMenu without destroying it!!
Put this code on the form that has owned the popup menu.
It simulates a mouse click (without click really), making windows think
that de user has clicked the mouse buttom and so hides the TPopupMenu.
---------------------------------------------------------------------}
procedure HidePopupMenu;
begin
PostMessage(Handle, WM_LBUTTONDOWN, MK_LBUTTON, 0);
PostMessage(Handle, WM_LBUTTONUP, MK_LBUTTON, 0);
end;