Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
796 views
in Technique[技术] by (71.8m points)

inno setup - How to change MsgBox message caption at runtime?

I need to change the default caption of a MsgBox message box at runtime. Currently it constantly shows the value of the SetupAppTitle directive as a caption:

[Setup]
SetupAppTitle=myAppName

But this is specified at compilation time. How to do this at runtime, e.g. from a [Code] section ?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I don't think changing of the application title (if possible) would be a good idea only for displaying dialog title. So I would use the Windows MessageBox which is even used by the MsgBox. Here is a simple example for Ansi/Unicode versions of Inno Setup:

[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;

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...