Forms Delphi

{
Shows all Menu items from the MenuIndex on right-aligned.
Alle MenuItem werden ab dem MenuIndex rechts angezeigt.
}
procedure TForm1.FormCreate(Sender: TObject);
const
MenuIndex = 3;
var
MII: TMenuItemInfo;
MainMenu: hMenu;
Buffer: array[0..50] of Char;
begin
MainMenu := GetMenu(Handle);
with MII do
begin
cbSize := SizeOf(MII);
fMask := MIIM_TYPE;
dwTypeData := Buffer;
cch := SizeOf(Buffer);
GetMenuItemInfo(MainMenu, MenuIndex, True, MII);
fType := fType or MFT_RIGHTJUSTIFY;
SetMenuItemInfo(MainMenu, MenuIndex, True, MII);
DrawMenuBar(Handle);
end;
end;