Inno Setup - BorderIcons dropdown menu

2020-08-01 06:54发布

问题:

I found out that when you click on icon of installer in top left corner, dropdown menu appears, showing off Minimize, Maximize, Close and About options...

When I click About, it shows info about Inno Setup version, which I really don't want to be there.

Am I able to somehow disable whole this dropdown menu without actually disabling whole System Menu or disabling border? Or minimally disable About option or change its contents to my own, so it is minimally useful in some way.

Thanks for any kind of help with this issue.

回答1:

You can remove the about menu item using the WinAPI DeleteMenu function. First you must retrieve a handle to the system menu and then remove the menu entry using DeleteMenu function.

Try this code:

[Code]
const
  MF_BYCOMMAND = $00000000;
  MF_BYPOSITION = $00000400;

type
  HMENU = THandle;

function GetSystemMenu(hWnd: HWND; bRevert: BOOL): HMENU; external 'GetSystemMenu@user32.dll stdcall';
function DeleteMenu(hMenu: HMENU; uPosition, uFlags: UINT): BOOL; external 'DeleteMenu@user32.dll stdcall';
function GetMenuItemCount(hMenu: HMENU): Integer; external 'GetMenuItemCount@user32.dll stdcall';

procedure InitializeWizard;
var
  SystemMenu: HMENU;
begin
  { get the menu handle }
  SystemMenu := GetSystemMenu(WizardForm.Handle, False);
  { delete the `About Setup` menu (which has ID 9999) }
  DeleteMenu(SystemMenu, 9999, MF_BYCOMMAND);
  { delete the separator }
  DeleteMenu(SystemMenu, GetMenuItemCount(SystemMenu)-1, MF_BYPOSITION);
  { ... }
end;

Also you can use the same technique to add your own system menu entries.



标签: inno-setup