Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
using user32.dll defined functions: GetScrollInfo
#1
Hello again,

I am attempting to receive the scrollbar range of a form, say in notepad.

This is what I came up with:


Macro Macro6
Code:
Copy      Help
int w=win(" - Notepad" "Notepad")
Acc a.Find(w "SCROLLBAR" "Vertical" "class=Edit[]id=15" 0x1035)
int hwndScrollbar=child(a) ;;Toolbar handle

def SB_CTL 2
def SIF_RANGE 0x1
def SIF_PAGE 0x2
dll user32 #GetScrollInfo hWnd nBar SCROLLINFO'lpsi 
SCROLLINFO tSI
tSI.cbSize=sizeof(SCROLLINFO)
tSI.fMask= SIF_RANGE | SIF_PAGE

GetScrollInfo(hwndScrollbar SB_CTL tSI)
out tSI.nMax


I get the following error:
Quote:Error (RT) in Macro6:  Exception 0xC0000005. Access violation. Cannot read memory at 0x1C. In USER32.dll at 0x7530A8EE (0x752D0000+0x3A8EE).    

Any advice will be much appreciated,
Cuitino
#2
you had a couple things incorrect
Code:
Copy      Help
int w=id(15 "Notepad")
SCROLLINFO tSI.cbSize=sizeof(tSI)
tSI.fMask=SIF_ALL
GetScrollInfo(w SB_VERT &tSI)
out tSI.nMax
#3
Thanks for your reply Kevin,

Your code appears to count the number of lines in notepad.
#4
Oh I got it, the scroll range is given by nMax-nPage+1.

Say I wanted to do the same for a Microsoft Word document. What do I set for hWnd? I tried the handle for the scrollbar, but that didn't work
#5
Try accessible object functions. Scrollbars usually are accessible objects. At least can get position if not range.


Forum Jump:


Users browsing this thread: 1 Guest(s)