// 这个不好
procedure TForm1.Button1Click(Sender: TObject);
var
m:HMenu;
begin
m:=menu.Handle ;
m:=getsubmenu(m,0);
TrackPopupMenu(m,TPM_LEFTALIGN,10,10,0,handle,0);
end;
//主要是菜单项位置的确定,点出第一个菜单项
procedure TForm1.Button2Click(Sender: TObject);
var
p:TPoint;
begin
p.x:=5;
p.y:=0;
p:=clienttoscreen(p);
p.y:=p.y-5;
setcursorpos(p.x,p.y);
mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);
// 加个 up 也可以
mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);
end;