Scalabium Software

SMExport/SMImport suites
Knowledge for your independence'.
Home Delphi and C++Builder tips

#60: How can I align a menu item to right?

The Microsoft GUI guide not allow to change the align of some menu item but from DOS-time personally I like to align a Help menu item to right.

But in some applications from Microsoft I saw the right-aligned menu item too:) If you want to align the item in own application, you can call the ModifyMenu function with MF_POPUP or MF_HELP flag.

View example:


procedure TForm1.FormCreate(Sender: TObject); 
  ModifyMenu(yourMainMenu.Handle, 0, MF_BYPOSITION or MF_POPUP or MF_HELP, yourMenuItem.Handle, 'yourCaption'); 

The altrenative method:

  MMI: TMenuItemInfo;
  MyMenu: hMenu;
  Buffer: array[0..79] of Char;
  MyMenu := GetMenu(Handle);
  // Handle is the handle of the form that contains the menu
  MMI.cbSize := SizeOf(MMI);
  MMI.fMask := MIIM_TYPE;
  MMI.dwTypeData := Buffer;
  MMI.cch := SizeOf(Buffer);
  GetMenuItemInfo(MyMenu, 1, True, MMI);
  // (..., 1, True, ...)  means that help is the second menu item.
  SetMenuItemInfo(MyMenu, 1, True, MMI);

PS: I'm not sure that this code will work on each Windows platform.

Published: January 18, 2000

See also
Paradox Viewer
Excel Web-stream
Clarion Viewer
ABA Spreadsheet Convert
Viewer for MS Outlook Messages
Viewer for TNEF-files (winmail.dat)
ABA Database Convert
Paradox to Text converter
Fast Document Viewer
Word Web-stream

Contact to webmaster


Borland Software Code Gear Scalabium Delphi tips

Copyright© 1998-2018, Scalabium Software. All rights reserved.

SMExport advertising