//这是我刚写的一个测试例子, 可以遍历整个菜单
procedure TForm1.FindMenuItem(Item: TMenuItem);
var
I: Integer;
begin
for I := 0 to Item.Count - 1 do
begin
Memo1.Lines.Add(Item.Caption);
FindMenuItem(Item);
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
I: Integer;
begin
Memo1.Lines.Clear;
for I := 0 to MainMenu1.Items.Count - 1 do
begin
Memo1.Lines.Add(MainMenu1.Items.Caption);
FindMenuItem(MainMenu1.Items);
end;
end;