是否可以在Inno Setup的wpLicense页面中检查ScrollBar的位置而无需编写自定义备忘录页面?
例如
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;
解决方法
没有直接访问这些滚动条,但您可以这样使用
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;