runsnake Posted September 9, 2011 Posted September 9, 2011 Following code, only Track box scrolled, But the contents in the NOTEPAD won't scroll, why ? #include <GUIScrollBars.au3> #include <ScrollBarConstants.au3> Run("Notepad") Sleep(200) $hWin = WinGetHandle("[CLASS:Notepad]") $hCtrl = ControlGetHandle("[CLASS:Notepad]", "", "Edit1") WinActivate($hCtrl) For $i = 1 To 40 ControlSend($hWin, "", "Edit1", $i & @LF) Next ControlSend($hWin, "", "Edit1", "{PGUP}") $Max = _GUIScrollBars_GetScrollInfoMax($hCtrl, $SB_VERT) $TrackPos = _GUIScrollBars_GetScrollInfoTrackPos($hCtrl, $SB_VERT) $PageSize = _GUIScrollBars_GetScrollInfoPage($hCtrl, $SB_VERT) For $i = $TrackPos To $Max - $PageSize + 1 Step 1 SetScrollPos($hCtrl, $SB_VERT, $i) ;_GUIScrollBars_ScrollWindow($hWin, 0, 1) Sleep(100) Next Func SetScrollPos($Hwnd, $nBar, $nPos, $bRedraw = True) $PrePos = DllCall("User32.dll", "int", "SetScrollPos", "HWND", $Hwnd, "int", $nBar, "int", $nPos, "int", $bRedraw) If @error Then Return "" Return $PrePos[0] EndFunc
javasqlrpg Posted September 9, 2011 Posted September 9, 2011 (edited) nevermind. Edited September 9, 2011 by javasqlrpg
javasqlrpg Posted September 9, 2011 Posted September 9, 2011 try the following code #include <GUIScrollBars.au3> #include <ScrollBarConstants.au3> #include <SendMessage.au3> #include <WindowsConstants.au3> Run("Notepad") Sleep(200) $hWin = WinGetHandle("[CLASS:Notepad]") $hCtrl = ControlGetHandle("[CLASS:Notepad]", "", "Edit1") WinActivate($hCtrl) For $i = 1 To 40 ControlSend($hWin, "", "Edit1", $i & @LF) Next ControlSend($hWin, "", "Edit1", "{PGUP}") Sleep(500) $Max = _GUIScrollBars_GetScrollInfoMax($hCtrl, $SB_VERT) $TrackPos = _GUIScrollBars_GetScrollInfoTrackPos($hCtrl, $SB_VERT) $PageSize = _GUIScrollBars_GetScrollInfoPage($hCtrl, $SB_VERT) For $i = $TrackPos To $Max - $PageSize + 1 Step 1 _SendMessage($hCtrl, $WM_VSCROLL, $SB_LINEDOWN, 0) Sleep(100) Next
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now