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

前端 未结 2 574
渐次进展
渐次进展 2020-12-21 09:28

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 CurPageCha         


        
2条回答
  •  Happy的楠姐
    2020-12-21 10:15

    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;
    

提交回复
热议问题