procedure OpenMenu(h: THandle; menu, zeile: byte);
var x: integer;
begin
PostMessage(h, WM_SYSCOMMAND, SC_KEYMENU, 0);
for x := 1 to menu do
PostMessage(h, WM_KEYDOWN, VK_RIGHT, 0);
PostMessage(h, WM_KEYDOWN, VK_RETURN, 0);
for x := 1 to zeile do
PostMessage(h, WM_KEYDOWN, VK_DOWN, 0);
end;
// Beispiel 1 -----------------------------------------------
// Erstes Menü, zweite Zeile
procedure TForm1.Button1Click(Sender: TObject);
begin
openmenu(handle, 0, 1);
end;
// Beispiel 2 -----------------------------------------------
// Zweites Menü, erste Zeile
procedure TForm1.Button2Click(Sender: TObject);
begin
openmenu(handle, 1, 0);
end;
// Beispiel 3 -----------------------------------------------
// Systemmenü, dritte Zeile
procedure TForm1.Button3Click(Sender: TObject);
begin
openmenu(handle, Mainmenu1.items.count, 2);
end;