这是代码......
ifdef UNICODE
#define AW "W"
#else
#define AW "A"
#endif
const
MB_TIMEDOUT = 32000;
MB_ICONERROR = $10;
MB_ICONQUESTION = $20;
MB_ICONWARNING = $30;
MB_ICONINFORMATION = $40;
function MessageBoxTimeout(hWnd: HWND; lpText: string; lpCaption: string;
uType: UINT; wLanguageId: Word; dwMilliseconds: DWORD): Integer;
external 'MessageBoxTimeout{#AW}@user32.dll stdcall';
procedure InitializeWizard;
begin
MessageBoxTimeout(WizardForm.Handle, 'Some ' +
'message', 'Setup', MB_OK or MB_ICONINFORMATION, 0, 5000);
end;
我只想在没有按钮的情况下显示消息框。要添加或删除哪些代码?我会在哪里插入它?谢谢!
How to disable the “Next” button on the wizard form in Inno Setup?的代码是否适用于我的脚本?我似乎无法使其发挥作用。
答案 0 :(得分:1)
你不能。
但正如您从MsgBox - Make unclickable OK Button and change to countdown - Inno Setup已经知道的那样,您可以自己从头开始实现消息框。这样,您可以以任何方式自定义它。
实际上,您只需要从我对上述问题的回答中删除该按钮。
[Files]
Source: InnoCallback.dll; Flags: dontcopy
[Code]
type
TTimerProc = procedure(H: LongWord; Msg: LongWord; IdEvent: LongWord; Time: LongWord);
function SetTimer(hWnd: LongWord; nIDEvent, uElapse: LongWord;
lpTimerFunc: LongWord): LongWord; external 'SetTimer@user32.dll stdcall';
function KillTimer(hWnd: HWND; uIDEvent: LongWord): BOOL;
external 'KillTimer@user32.dll stdcall';
function WrapTimerProc(Callback: TTimerProc; ParamCount: Integer): LongWord;
external 'wrapcallback@files:innocallback.dll stdcall';
var
TimeoutForm: TSetupForm;
procedure TimeoutProc(H: LongWord; Msg: LongWord; IdEvent: LongWord; Time: LongWord);
begin
TimeoutForm.Tag := TimeoutForm.Tag - 1;
if TimeoutForm.Tag = 0 then
begin
TimeoutForm.Close;
end;
end;
procedure TimeoutMessageBoxCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
{ Prevent the dialog from being closed by the X button and Alt-F4 }
CanClose := (TimeoutForm.Tag = 0);
end;
procedure TimeoutMessageBox(Message: string; Seconds: Integer);
var
MessageLabel: TLabel;
TimeoutCallback: LongWord;
Timer: LongWord;
begin
TimeoutForm := CreateCustomForm;
try
TimeoutForm.ClientWidth := ScaleX(256);
TimeoutForm.ClientHeight := ScaleY(64);
TimeoutForm.Caption := 'Information';
TimeoutForm.Position := poMainFormCenter;
TimeoutForm.OnCloseQuery := @TimeoutMessageBoxCloseQuery;
TimeoutForm.Tag := Seconds;
MessageLabel := TLabel.Create(TimeoutForm);
MessageLabel.Top := ScaleY(16);
MessageLabel.Left := ScaleX(16);
MessageLabel.AutoSize := True;
MessageLabel.Caption := Message;
MessageLabel.Parent := TimeoutForm;
TimeoutCallback := WrapTimerProc(@TimeoutProc, 4);
Timer := SetTimer(0, 0, 1000, TimeoutCallback);
try
TimeoutForm.ShowModal();
finally
KillTimer(0, Timer);
end;
finally
TimeoutForm.Free();
TimeoutForm := nil;
end;
end;