Inno setup disable two buttons on the same page - inno-setup

Disable two buttons on the same page
I tried several ways but did not get the closer this example was not correct
[button next = with time] [button back= no time (only disable)]
help to find the error bound
[Code]
var
Counter: Integer;
TimerID: Integer;
type
TTimerProc = procedure(Wnd: HWND; Msg: UINT; TimerID: UINT_PTR;
SysTime: DWORD);
function WrapTimerProc(Callback: TTimerProc; ParamCount: Integer): LongWord;
external 'wrapcallback#files:InnoCallback.dll stdcall';
function SetTimer(hWnd: HWND; nIDEvent, uElapse: UINT;
lpTimerFunc: UINT): UINT; external 'SetTimer#user32.dll stdcall';
function KillTimer(hWnd: HWND; uIDEvent: UINT): BOOL;
external 'KillTimer#user32.dll stdcall';
procedure OnTimerTick(Wnd: HWND; Msg: UINT; TimerID: UINT_PTR;
SysTime: DWORD);
begin
Counter := Counter - 1;
begin
Counter := Counter - 1;
if Counter <= 0 then
begin
WizardForm.NextButton.Enabled := True;
WizardForm.NextButton.Caption := SetupMessage(msgButtonInstall);
if TimerID <> 0 then
KillTimer(0, TimerID);
end
else
WizardForm.NextButton.Caption := SetupMessage(msgButtonInstall) +
IntToStr(Counter);
end;
// begin
WizardForm.BackButton.Enabled := True;
if TimerID <> 0 then
begin
if KillTimer(0, TimerID) then
TimerID := 0;
end;
end;
procedure DisableNextButton(Timeout: Integer);
var
TimerCallback: LongWord;
begin
Counter := Timeout;
WizardForm.NextButton.Enabled := False;
WizardForm.NextButton.Caption := SetupMessage(msgButtonInstall) + IntToStr(Counter);
TimerCallback := WrapTimerProc(#OnTimerTick, 4);
TimerID := SetTimer(0, 0, 1000, TimerCallback);
end;
procedure DisableBackButton(Timeout: UINT);
var
TimerCallback: LongWord;
begin
WizardForm.BackButton.Enabled := False;
TimerCallback := WrapTimerProc(#OnTimerTick, 4);
TimerID := SetTimer(0, 0, Timeout, TimerCallback);
end;
procedure CurPageChanged5(CurPageID: Integer);
begin
if CurPageID = wpSelectTasks then
DisableNextButton(10);
end;
procedure CurPageChanged6(CurPageID: Integer);
begin
if CurPageID = wpSelectTasks then
DisableBackButton(5000);
end;

To disable both buttons, the next button and back button for a specified time while only next button will have the countdown timer caption, you can use the following modified script based on this post:
[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program
[Files]
Source: "InnoCallback.dll"; DestDir: "{tmp}"; Flags: dontcopy
[Code]
var
Counter: Integer;
TimerID: Integer;
type
TTimerProc = procedure(Wnd: HWND; Msg: UINT; TimerID: UINT_PTR;
SysTime: DWORD);
function WrapTimerProc(Callback: TTimerProc; ParamCount: Integer): LongWord;
external 'wrapcallback#files:InnoCallback.dll stdcall';
function SetTimer(hWnd: HWND; nIDEvent, uElapse: UINT;
lpTimerFunc: UINT): UINT; external 'SetTimer#user32.dll stdcall';
function KillTimer(hWnd: HWND; uIDEvent: UINT): BOOL;
external 'KillTimer#user32.dll stdcall';
procedure OnTimerTick(Wnd: HWND; Msg: UINT; TimerID: UINT_PTR;
SysTime: DWORD);
begin
Counter := Counter - 1;
if Counter <= 0 then
begin
WizardForm.BackButton.Enabled := True;
WizardForm.NextButton.Enabled := True;
WizardForm.NextButton.Caption := SetupMessage(msgButtonNext);
if TimerID <> 0 then
KillTimer(0, TimerID);
end
else
WizardForm.NextButton.Caption := SetupMessage(msgButtonNext) +
IntToStr(Counter);
end;
procedure DisableNavigateButtons(Timeout: Integer);
var
TimerCallback: LongWord;
begin
Counter := Timeout;
WizardForm.BackButton.Enabled := False;
WizardForm.NextButton.Enabled := False;
WizardForm.NextButton.Caption := SetupMessage(msgButtonNext) +
IntToStr(Counter);
TimerCallback := WrapTimerProc(#OnTimerTick, 4);
TimerID := SetTimer(0, 0, 1000, TimerCallback);
end;
procedure CurPageChanged(CurPageID: Integer);
begin
if CurPageID = wpSelectDir then
DisableNavigateButtons(5);
end;

Related

Inno Setup - Animate a control roll out from right in a determinate page

I am trying to use this code (with InnoCallback DLL library):
[Code]
var
MainPanelAnimated: Boolean;
AnimationTimer: LongWord;
procedure AnimationTimerProc(
H: LongWord; Msg: LongWord; IdEvent: LongWord; Time: LongWord);
var
L: Integer;
begin
L := WizardForm.MainPanel.Left + ScaleX(5);
if L > 0 then
begin
L := 0;
KillTimer(0, AnimationTimer);
end;
WizardForm.MainPanel.Left := L;
end;
procedure CurPageChanged(CurPageID: Integer);
var
HoverTimerCallback: LongWord;
begin
if WizardForm.OuterNotebook.ActivePage = WizardForm.InnerPage then
begin
if not MainPanelAnimated then
begin
HoverTimerCallback := WrapTimerProc(#AnimationTimerProc, 4);
AnimationTimer := SetTimer(0, 0, 5, HoverTimerCallback);
WizardForm.MainPanel.Left := -WizardForm.MainPanel.Width;
MainPanelAnimated := True;
end;
end;
end;
from How to animate a control roll out in Inno Setup (answer of Martin Prikryl), to show the same effect but from right to left and in a determinate page of setup. How to do this?
Use CurPageID in CurPageChanged to select on what page to show the animation.
[Code]
function SetTimer(hWnd: longword; nIDEvent, uElapse: LongWord; lpTimerFunc: LongWord):
LongWord; external 'SetTimer#user32.dll stdcall';
function KillTimer(hWnd, nIDEvent: LongWord): LongWord;
external 'KillTimer#User32.dll stdcall';
var
AnimationTimer: LongWord;
procedure AnimationTimerProc(
H: LongWord; Msg: LongWord; IdEvent: LongWord; Time: LongWord);
var
L: Integer;
begin
L := WizardForm.MainPanel.Left - ScaleX(5);
if L < 0 then
begin
L := 0;
KillTimer(0, AnimationTimer);
end;
WizardForm.MainPanel.Left := L;
end;
procedure CurPageChanged(CurPageID: Integer);
begin
if CurPageID = wpReady then
begin
AnimationTimer := SetTimer(0, 0, 5, CreateCallback(#AnimationTimerProc));
WizardForm.MainPanel.Left := WizardForm.MainPanel.Width;
end;
end;
For CreateCallback function, you need Inno Setup 6. If you are stuck with Inno Setup 5, you can use WrapCallback function from InnoTools InnoCallback library.

Inno Setup: Enlarge component page only with preview and description

I need help from you to merge two scripts found here to have preview image on a maximized components windows:
Add image into the components list - component description
Long descriptions on Inno Setup components
Edit: Thanks to Martin Prikryl. With his patience and his help, I successfully merge these two scripts.
Your preview image should have a resolution of 208x165 in .bmp
[Files]
...
Source: "1.bmp"; Flags: dontcopy
Source: "2.bmp"; Flags: dontcopy
Source: "3.bmp"; Flags: dontcopy
Source: "InnoCallback.dll"; Flags: dontcopy
[Code]
var
LastMouse: TPoint;
type
TTimerProc = procedure(H: LongWord; Msg: LongWord; IdEvent: LongWord; Time: LongWord);
function GetCursorPos(var lpPoint: TPoint): BOOL; external 'GetCursorPos#user32.dll stdcall';
function SetTimer(hWnd: longword; nIDEvent, uElapse: LongWord; lpTimerFunc: LongWord): LongWord; external 'SetTimer#user32.dll stdcall';
function ScreenToClient(hWnd: HWND; var lpPoint: TPoint): BOOL; external 'ScreenToClient#user32.dll stdcall';
function ClientToScreen(hWnd: HWND; var lpPoint: TPoint): BOOL; external 'ClientToScreen#user32.dll stdcall';
function ListBox_GetItemRect(const hWnd: HWND; const Msg: Integer; Index: LongInt; var Rect: TRect): LongInt; external 'SendMessageW#user32.dll stdcall';
const
LB_GETITEMRECT = $0198;
LB_GETTOPINDEX = $018E;
function WrapTimerProc(Callback: TTimerProc; ParamCount: Integer): LongWord; external 'wrapcallback#files:InnoCallback.dll stdcall';
function FindControl(Parent: TWinControl; P: TPoint): TControl;
var
Control: TControl;
WinControl: TWinControl;
I: Integer;
P2: TPoint;
begin
for I := 0 to Parent.ControlCount - 1 do
begin
Control := Parent.Controls[I];
if Control.Visible and
(Control.Left <= P.X) and (P.X < Control.Left + Control.Width) and
(Control.Top <= P.Y) and (P.Y < Control.Top + Control.Height) then
begin
if Control is TWinControl then
begin
P2 := P;
ClientToScreen(Parent.Handle, P2);
WinControl := TWinControl(Control);
ScreenToClient(WinControl.Handle, P2);
Result := FindControl(WinControl, P2);
if Result <> nil then Exit;
end;
Result := Control;
Exit;
end;
end;
Result := nil;
end;
function PointInRect(const Rect: TRect; const Point: TPoint): Boolean;
begin
Result := (Point.X >= Rect.Left) and (Point.X <= Rect.Right) and
(Point.Y >= Rect.Top) and (Point.Y <= Rect.Bottom);
end;
function ListBoxItemAtPos(ListBox: TCustomListBox; Pos: TPoint): Integer;
var
Count: Integer;
ItemRect: TRect;
begin
Result := SendMessage(ListBox.Handle, LB_GETTOPINDEX, 0, 0);
Count := ListBox.Items.Count;
while Result < Count do
begin
ListBox_GetItemRect(ListBox.Handle, LB_GETITEMRECT, Result, ItemRect);
if PointInRect(ItemRect, Pos) then Exit;
Inc(Result);
end;
Result := -1;
end;
var
CompLabel: TLabel;
CompImage: TBitmapImage;
LoadingImage: Boolean;
procedure HoverComponentChanged(Index: Integer);
var
Description: string;
Image: string;
ImagePath: string;
begin
case Index of
0: begin Description := 'Component 1'; Image := '1.bmp'; end;
1: begin Description := 'Component 2'; Image := '2.bmp'; end;
2: begin Description := 'Component 3'; Image := '3.bmp'; end;
else
Description := 'Move your mouse over a component to see its description.';
end;
CompLabel.Caption := Description;
if Image <> '' then
begin
// The ExtractTemporaryFile pumps the message queue, prevent recursion
if not LoadingImage then
begin
LoadingImage := True;
try
ImagePath := ExpandConstant('{tmp}\' + Image);
if not FileExists(ImagePath) then
begin
ExtractTemporaryFile(Image);
end;
CompImage.Bitmap.LoadFromFile(ImagePath);
finally
LoadingImage := False;
end;
end;
CompImage.Visible := True;
end
else
begin
CompImage.Visible := False;
end;
end;
procedure HoverTimerProc(H: LongWord; Msg: LongWord; IdEvent: LongWord; Time: LongWord);
var
P: TPoint;
Control: TControl;
Index: Integer;
begin
GetCursorPos(P);
if P <> LastMouse then // just optimization
begin
LastMouse := P;
ScreenToClient(WizardForm.Handle, P);
if (P.X < 0) or (P.Y < 0) or
(P.X > WizardForm.ClientWidth) or (P.Y > WizardForm.ClientHeight) then
begin
Control := nil;
end
else
begin
Control := FindControl(WizardForm, P);
end;
Index := -1;
if Control = WizardForm.ComponentsList then
begin
P := LastMouse;
ScreenToClient(WizardForm.ComponentsList.Handle, P);
Index := ListBoxItemAtPos(WizardForm.ComponentsList, P);
end;
HoverComponentChanged(Index);
end;
end;
type
TPositionStorage = array of Integer;
var
CompPageModified: Boolean;
CompPagePositions: TPositionStorage;
procedure SaveComponentsPage(out Storage: TPositionStorage);
begin
SetArrayLength(Storage, 10);
Storage[0] := WizardForm.Height;
Storage[1] := WizardForm.NextButton.Top;
Storage[2] := WizardForm.BackButton.Top;
Storage[3] := WizardForm.CancelButton.Top;
Storage[4] := WizardForm.ComponentsList.Height;
Storage[5] := WizardForm.OuterNotebook.Height;
Storage[6] := WizardForm.InnerNotebook.Height;
Storage[7] := WizardForm.Bevel.Top;
Storage[8] := WizardForm.BeveledLabel.Top;
Storage[9] := WizardForm.ComponentsDiskSpaceLabel.Top;
end;
procedure LoadComponentsPage(const Storage: TPositionStorage;
HeightOffset: Integer);
begin
if GetArrayLength(Storage) <> 10 then
RaiseException('Invalid storage array length.');
WizardForm.Height := Storage[0] + HeightOffset;
WizardForm.NextButton.Top := Storage[1] + HeightOffset;
WizardForm.BackButton.Top := Storage[2] + HeightOffset;
WizardForm.CancelButton.Top := Storage[3] + HeightOffset;
WizardForm.ComponentsList.Height := Storage[4] + ScaleY(150);
WizardForm.OuterNotebook.Height := Storage[5] + HeightOffset;
WizardForm.InnerNotebook.Height := Storage[6] + HeightOffset;
WizardForm.Bevel.Top := Storage[7] + HeightOffset;
WizardForm.BeveledLabel.Top := Storage[8] + HeightOffset;
WizardForm.ComponentsDiskSpaceLabel.Top := Storage[9] + HeightOffset;
end;
procedure InitializeWizard1();
var
HoverTimerCallback: LongWord;
begin
HoverTimerCallback := WrapTimerProc(#HoverTimerProc, 4);
SetTimer(0, 0, 50, HoverTimerCallback);
CompLabel := TLabel.Create(WizardForm);
CompLabel.Parent := WizardForm.SelectComponentsPage;
CompLabel.Left := WizardForm.ComponentsList.Left;
CompLabel.Width := WizardForm.ComponentsList.Width div 2;
CompLabel.Height := ScaleY(64);
CompLabel.Top := WizardForm.ComponentsList.Top + WizardForm.ComponentsList.Height - CompLabel.Height + ScaleY(150);
CompLabel.AutoSize := false;
CompLabel.WordWrap := True;
CompImage := TBitmapImage.Create(WizardForm);
CompImage.Parent := WizardForm.SelectComponentsPage;
CompImage.Top := CompLabel.Top;
CompImage.Width := CompImage.Width + ScaleX(128);
CompImage.Height := CompLabel.Height + ScaleX(128);
CompImage.Left := WizardForm.ComponentsList.Left + WizardForm.ComponentsList.Width - CompLabel.Width;
WizardForm.ComponentsList.Height := WizardForm.ComponentsList.Height - CompLabel.Height - ScaleY(8);
end;
procedure InitializeWizard2();
begin
CompPageModified := False;
end;
procedure CurPageChanged(CurPageID: Integer);
begin
if CurpageID = wpSelectComponents then
begin
SaveComponentsPage(CompPagePositions);
LoadComponentsPage(CompPagePositions, ScaleY(250));
CompPageModified := True;
end
else
if CompPageModified then
begin
LoadComponentsPage(CompPagePositions, 0);
CompPageModified := False;
end;
end;
procedure InitializeWizard();
begin
InitializeWizard1();
InitializeWizard2();
end;
Just copy both codes and merge the InitializeWizard implementations according to this guide:
Merging event function (InitializeWizard) implementations from different sources.
Though, actually, the InitializeWizard in the Larger “Select Components” page in Inno Setup is noop. You can skip that. And you do not need to merge anything.
The only other change you need to do, is not to enlarge the ComponentsList in the LoadComponentsPage.

How to mute audio (change volume) with BASS library in Inno Setup

This code from Bass Audio Library on/off Button does "Pause", how to change it to "Mute"?
What should I change?
const
BASS_SAMPLE_LOOP = 4;
BASS_ACTIVE_STOPPED = 0;
BASS_ACTIVE_PLAYING = 1;
BASS_ACTIVE_STALLED = 2;
BASS_ACTIVE_PAUSED = 3;
BASS_UNICODE = $80000000;
BASS_CONFIG_GVOL_STREAM = 5;
const
#ifndef UNICODE
EncodingFlag = 0;
#else
EncodingFlag = BASS_UNICODE;
#endif
type
HSTREAM = DWORD;
function BASS_Init(device: LongInt; freq, flags: DWORD;
win: HWND; clsid: Cardinal): BOOL;
external 'BASS_Init#files:bass.dll stdcall';
function BASS_StreamCreateFile(mem: BOOL; f: string; offset1: DWORD;
offset2: DWORD; length1: DWORD; length2: DWORD; flags: DWORD): HSTREAM;
external 'BASS_StreamCreateFile#files:bass.dll stdcall';
function BASS_Start: BOOL;
external 'BASS_Start#files:bass.dll stdcall';
function BASS_Pause: BOOL;
external 'BASS_Pause#files:bass.dll stdcall';
function BASS_ChannelPlay(handle: DWORD; restart: BOOL): BOOL;
external 'BASS_ChannelPlay#files:bass.dll stdcall';
function BASS_SetConfig(option: DWORD; value: DWORD ): BOOL;
external 'BASS_SetConfig#files:bass.dll stdcall';
function BASS_ChannelIsActive(handle: DWORD): DWORD;
external 'BASS_ChannelIsActive#files:bass.dll stdcall';
function BASS_Free: BOOL;
external 'BASS_Free#files:bass.dll stdcall';
var
SoundStream: HSTREAM;
SoundCtrlButton: TNewButton;
procedure SoundCtrlButtonClick(Sender: TObject);
begin
case BASS_ChannelIsActive(SoundStream) of
BASS_ACTIVE_PLAYING:
begin
if BASS_Pause then
SoundCtrlButton.Caption :=
ExpandConstant('{cm:SoundCtrlButtonCaptionSoundOn}');
end;
BASS_ACTIVE_PAUSED:
begin
if BASS_Start then
SoundCtrlButton.Caption :=
ExpandConstant('{cm:SoundCtrlButtonCaptionSoundOff}');
end;
end;
end;
procedure InitializeWizard;
begin
ExtractTemporaryFile('tune.mp3');
if BASS_Init(-1, 44100, 0, 0, 0) then
begin
SoundStream := BASS_StreamCreateFile(False,
ExpandConstant('{tmp}\tune.mp3'), 0, 0, 0, 0,
EncodingFlag or BASS_SAMPLE_LOOP);
BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, 2500);
BASS_ChannelPlay(SoundStream, False);
SoundCtrlButton := TNewButton.Create(WizardForm);
SoundCtrlButton.Parent := WizardForm;
SoundCtrlButton.Left := 8;
SoundCtrlButton.Top := WizardForm.ClientHeight -
SoundCtrlButton.Height - 8;
SoundCtrlButton.Width := 40;
SoundCtrlButton.Caption :=
ExpandConstant('{cm:SoundCtrlButtonCaptionSoundOff}');
SoundCtrlButton.OnClick := #SoundCtrlButtonClick;
end;
end;
procedure DeinitializeSetup;
begin
BASS_Free;
end;
To control volume level, use the BASS_SetConfig with option set to:
BASS_CONFIG_GVOL_STREAM for "stream", created e.g. using the BASS_StreamCreateFile;
BASS_CONFIG_GVOL_MUSIC for "music", created e.g. using BASS_MusicLoad.
The SoundCtrlButtonClick is replacement for the pause/resume implementation of the same-named function from your question.
var
Muted: Boolean;
procedure SoundCtrlButtonClick(Sender: TObject);
begin
if not Muted then
begin
if BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, 0) then
begin
SoundCtrlButton.Caption := 'unmute';
Muted := True;
end;
end
else
begin
if BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, 2500) then
begin
SoundCtrlButton.Caption := 'mute';
Muted := False;
end;
end;
end;

How to Delete / Hide / Disable [OK] button on message box

Here's the code...
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;
I just want the message box to appear without the button. What code to be added or removed? Where would I insert it? Thanks!
Does this a code from How to disable the “Next” button on the wizard form in Inno Setup? work with my script? I can't seem to to make it working.
You cannot.
But as you already know from MsgBox - Make unclickable OK Button and change to countdown - Inno Setup, you can implement the message box from a scratch yourself. This way, you can customize it any way you want.
Actually, all you need is to remove the button from my answer to the above question.
[Code]
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';
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;
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;
Timer := SetTimer(0, 0, 1000, CreateCallback(#TimeoutProc));
try
TimeoutForm.ShowModal();
finally
KillTimer(0, Timer);
end;
finally
TimeoutForm.Free();
TimeoutForm := nil;
end;
end;
For CreateCallback function, you need Inno Setup 6. If you are stuck with Inno Setup 5, you can use WrapCallback function from InnoTools InnoCallback library.

wpLicese Page check if ScrollBars position is max (Inno Setup)

Is it possible to check the position of ScrollBar in wpLicense Page in Inno Setup without having to write custom memo page?
e.g.
procedure CurPageChanged(CurPageID: Integer);
begin
if CurPageID = wpLicense then
WizardForm.LicenseAcceptedRadio.Enabled := False;
WizardForm.LicenseNotAcceptedRadio.Enabled := False;
if ScrollBar.Position := ScrollBar.Max then
WizardForm.LicenseAcceptedRadio.Enabled := True;
WizardForm.LicenseNotAcceptedRadio.Enabled := True;
end;
There is no direct access to those scroll bars, however you can use the GetScrollInfo function this way:
[code]
const
SB_VERT = 1;
SIF_RANGE = 1;
SIF_POS = 4;
SIF_PAGE = 2;
type
TScrollInfo = record
cbSize: UINT;
fMask: UINT;
nMin: Integer;
nMax: Integer;
nPage: UINT;
nPos: Integer;
nTrackPos: Integer;
end;
function GetScrollInfo(hWnd: HWND; BarFlag: Integer;
var ScrollInfo: TScrollInfo): BOOL;
external 'GetScrollInfo#user32.dll stdcall';
procedure CurPageChanged(CurPageID: Integer);
var
ScrollInfo: TScrollInfo;
begin
if CurPageID = wpLicense then
begin
ScrollInfo.cbSize := SizeOf(ScrollInfo);
ScrollInfo.fMask := SIF_RANGE or SIF_POS or SIF_PAGE;
if GetScrollInfo(WizardForm.LicenseMemo.Handle, SB_VERT, ScrollInfo) then
if ScrollInfo.nPos = ScrollInfo.nMax - ScrollInfo.nPage then
MsgBox('You are at the end of the license!', mbInformation, MB_OK);
end;
end;
That is what I have now. It works, however if you find any issues, just say as I like comments.
procedure OnScrollPosition(Wnd: HWND; Msg: UINT; TimerID: UINT_PTR;
SysTime: DWORD);
var
ScrollInfo: TScrollInfo;
begin
ScrollInfo.cbSize := SizeOf(ScrollInfo);
ScrollInfo.fMask := SIF_RANGE or SIF_POS or SIF_PAGE;
if GetScrollInfo(WizardForm.LicenseMemo.Handle, SB_VERT, ScrollInfo) then
if ScrollInfo.nPos = ScrollInfo.nMax - ScrollInfo.nPage then
begin
WizardForm.LicenseAcceptedRadio.Enabled := True;
WizardForm.LicenseNotAcceptedRadio.Enabled := True;
end;
end;
procedure ScrollPosition();
var
TimerCallback: LongWord;
begin
TimerCallback := WrapTimerProc(#OnScrollPosition, 4);
TimerID := SetTimer(0, 0, 500, TimerCallback);
end;
procedure CurPageChanged(CurPageID: Integer);
var
ScrollInfo: TScrollInfo;
begin
if CurPageID = wpInstalling then
StartSlideTimer
else
KillSlideTimer;
if CurPageID = wpLicense then
WizardForm.LicenseAcceptedRadio.Enabled := False;
WizardForm.LicenseNotAcceptedRadio.Enabled := False;
ScrollPosition
end;

Resources