Inno Setup禁用关闭按钮(X) [英] Inno Setup Disable close button (X)

查看:291
本文介绍了Inno Setup禁用关闭按钮(X)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何禁用关闭"按钮(边框样式)?

How to disable the Close button (borderstyle)?

我想将其与隐藏系统菜单中的关于设置" 命令结合使用:
Inno设置-BorderIcons下拉菜单

I want to combine that with hiding "About Setup" command from system menu:
Inno Setup - BorderIcons dropdown menu

推荐答案

使用

Use EnableMenuItem WinAPI function:

function GetSystemMenu(hWnd: THandle; bRevert: Boolean): THandle;
  external 'GetSystemMenu@user32.dll stdcall';

function EnableMenuItem(hMenu: UINT; uIDEnableItem, uEnable: UINT): Boolean;
  external 'EnableMenuItem@user32.dll stdcall';

const
  MF_GRAYED = $1;
  MF_BYCOMMAND = $0;
  SC_CLOSE = $F060;

procedure DisableCloseButton;
var
  Menu: THandle;
begin
  Menu := GetSystemMenu(WizardForm.Handle, False);
  EnableMenuItem(Menu, SC_CLOSE, MF_BYCOMMAND or MF_GRAYED);
end;

您必须比InitializeWizard事件函数调用DisableCloseButton 稍后.

You have to call the DisableCloseButton later than from the InitializeWizard event function.

也许有个更好的地方可以调用它,但为简单起见,您可以从CurPageChanged调用它:

There maybe a better place to call it, but for a simplicity you can call it from CurPageChanged:

procedure CurPageChanged(CurPageID: Integer);
begin
  DisableCloseButton;
end;

但是请注意,您需要保留隐藏关于设置" 命令的代码InitializeWizard中,只需调用一次即可(并且可以在其中正常运行).

But note that you need to keep the code to hide "About Setup" command in InitializeWizard as that needs to be called only once (and it works there correctly).

屏幕截图显示了两个代码的组合:

The screenshot shows both codes combined:

这篇关于Inno Setup禁用关闭按钮(X)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆