MsgBox
実行時にメッセージボックスのデフォルトのキャプションを変更する必要があります。現在、SetupAppTitle
ディレクティブの値をキャプションとして常に表示しています。
[Setup]
SetupAppTitle=myAppName
ただし、これはコンパイル時に指定されます。実行時にこれを行う方法、たとえば[Code]
セクションから?
MsgBox
実行時にメッセージボックスのデフォルトのキャプションを変更する必要があります。現在、SetupAppTitle
ディレクティブの値をキャプションとして常に表示しています。
[Setup]
SetupAppTitle=myAppName
ただし、これはコンパイル時に指定されます。実行時にこれを行う方法、たとえば[Code]
セクションから?
アプリケーションのタイトルを(可能であれば)変更することは、ダイアログのタイトルを表示するためだけに良い考えではないと思います。MessageBox
だから私はでさえ使われているウィンドウズを使うでしょうMsgBox
。InnoSetupの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;
これは私が最終的にそれをした方法です:
[Code]
{ https://msdn.microsoft.com/en-us/library/windows/desktop/ms645505.aspx }
{ Use Windows MessageBox() function as an MsgBox() replacement. }
{ MessageBoxW is the UNICODE version of this API call. }
const
{ these are not exported in Inno Setup! }
MB_ICONERROR = $00000010;
MB_ICONWARNING = $00000030;
MB_ICONINFORMATION = $00000040;
MB_ICONQUESTION = $00000020;
function _MessageBoxW_(hWnd: Integer; lpText, lpCaption: String; uType: Cardinal): Integer;
external 'MessageBoxW@user32.dll stdcall';
{ Usage: SysMsgBox('Error', 'Shit happens!', MB_OK or MB_ICONERROR); }
{ res =: SysMsgBox('Question', 'blah blah', MB_YESNO or MB_ICONQUESTION); }
function SysMsgBox(const Caption, Message: String; const Flags: Integer): Integer;
begin
Result :=
_MessageBoxW_(StrToInt(ExpandConstant('{wizardhwnd}')), Message, Caption, Flags);
end;
助けてくれてありがとう!