wpLicese页面检查,如果滚动条位置是最大(Inno Setup的)(wpLicese Page

2019-06-24 09:46发布

是否有可能检查滚动条的wpLicense页在Inno Setup的位置,而无需编写自定义的备忘录页面?

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;

Answer 1:

还有就是那些滚动条不能直接访问,但是你可以使用GetScrollInfo功能是这样的:

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


Answer 2:

这就是我现在有。 它的工作原理,但是如果你发现任何问题,只是说,因为我喜欢的评论。

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;


文章来源: wpLicese Page check if ScrollBars position is max (Inno Setup)