我需要在运行时更改MsgBox
消息框的默认标题。当前,它会不断将SetupAppTitle
指令的值显示为标题:
[Setup]
SetupAppTitle=myAppName
但这是在编译时指定的。如何在运行时执行此操作,例如从
[Code]
部分? 最佳答案
我认为仅在显示对话框标题时更改应用程序标题(如果可能)不是一个好主意。因此,我将使用Windows MessageBox
,甚至MsgBox
也可以使用。这是Inno Setup的Ansi / Unicode版本的简单示例:
[Code]
const
MB_ICONERROR = $10;
MB_ICONQUESTION = $20;
MB_ICONWARNING = $30;
MB_ICONINFORMATION = $40;
#ifdef UNICODE
#define AW "W"
#else
#define AW "A"
#endif
function MessageBox(hWnd: HWND; lpText, lpCaption: string;
uType: UINT): Integer; external 'MessageBox{#AW}@user32.dll stdcall';
procedure ButtonOnClick(Sender: TObject);
begin
MessageBox(0, 'Message Text', 'Message Caption', MB_OK or MB_ICONINFORMATION);
end;