Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change system menu's item text

Status
Not open for further replies.

swim

Programmer
Jul 1, 2002
22
US
Hi,

Use the following code to change system menu item text. It works well, but the icon on the left of the item disappeared. The same problem is with AppendMenu function.

Any help?

procedure TForm1.ChangeSystemMenuItemText;
const
strCLOSE = 'Close This Window';
var
SysMenu : HMenu;
MenuItemInfo : TMenuItemInfo;
begin
SysMenu := GetSystemMenu(Handle, FALSE) ;
FillChar(MenuItemInfo,SizeOf(TMenuItemInfo), #0) ;
MenuItemInfo.cbSize := SizeOf(TMenuItemInfo) ;
MenuItemInfo.fMask := MIIM_TYPE or MIIM_ID or MIIM_STATE;
MenuItemInfo.fType := MFT_STRING;
MenuItemInfo.wId := SC_CLOSE;
MenuItemInfo.dwTypeData := strCLOSE;
MenuItemInfo.cch := Length(strCLOSE) ;
SetMenuItemInfo(SysMenu, SC_CLOSE, FALSE, MenuItemInfo) ;
end;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top