LB Booster
General >> General Board >> SetScrollPos
http://lbb.conforums.com/index.cgi?board=general&action=display&num=1439043365
SetScrollPos
Post by SarmedNafi on Aug 8th, 2015, 2:16pm
Dear Sir,
I need to use SetScrollPos function and let it work like GetScrollPos, I got error, can you help, please.
calldll #user32, "GetScrollPos", hscrolV as ulong, _SB_VERT as long, posv as long
https://msdn.microsoft.com/en-us/library/windows/desktop/bb787597(v=vs.85).aspx
Regards
Re: SetScrollPos
Post by SarmedNafi on Aug 8th, 2015, 3:02pm
Dear Sir,
I found a way to do that, don't disturb your self.
Thank you for being on the other side listen to us.
The following is the demo:
NOMAINWIN
WindowWidth = 559 : WindowHeight = 446
UpperLeftX = INT((DisplayWidth-WindowWidth)/2)
UpperLeftY = INT((DisplayHeight-WindowHeight)/2)
graphicbox #main.graphicbox1, 355, 25, 50, 285
stylebits #main.button1, _BS_MULTILINE, 0, 0, 0
button #main.button1, "Get", [button1Click], UL, 35, 125, 85, 30
stylebits #main.button2, _BS_MULTILINE, 0, 0, 0
button #main.button2, "Set", [button2Click], UL, 35, 195, 85, 30
textbox #main.textbox1, 30, 25, 190, 25
Open "Window Title" for Window as #main
#main "trapclose [quit]"
#main.graphicbox1 "setfocus; when mouseMove MouseChange"
#main "font ms_sans_serif 10"
#main.graphicbox1 "VERTSCROLLBAR on 0 "; 100
hscrolV=hwnd(#main.graphicbox1)
Wait
[quit]
close #main : END
Sub MouseChange handle$, X, Y
'X and Y contain mouse coordinates
'#handle$ contains graphicbox handle
End Sub
[button1Click]
calldll #user32, "GetScrollPos", hscrolV as ulong, _SB_VERT as long, posv as long
#main.textbox1 posv
wait
[button2Click]
#main.textbox1 "!contents? posv"
calldll #user32, "SetScrollPos", hscrolV as ulong, _SB_VERT as long, posv as long, redraw as Boolean
#main.graphicbox1 "refresh"
'#handle$ contains button handle
wait
Regards
Sarmed