WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Mouse and Cursor Topics

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Mouse Scroll Using Windows Messages

 Keywords:  SendMessageA WM_HSCROLL WM_VSCROLL Mouse Scroll Using Windows Messages Hex2Dec Hex Decimal FileCreateTemp cWndByClass SendMessage cSendMessage

;***************************************************************************
;**
;**  Mouse Scroll Using Windows Messages
;**
;**
;***************************************************************************
AddExtender("wwctl44i.dll") ; Control Manager Extender

appname = 'Notepad.exe'
title =  "~Notepad"
position = 100 ; try 10 (practical maximum position value of 65535)

#DefineFunction Hex2Dec(hex)
   str="0123456789ABCDEF"
   hex=StrTrim(StrUpper(hex))
   hexlen=StrLen(hex)
   dec=0
   For x=1 To hexlen
       dec=(dec*16) + StrIndex(str,StrSub(hex,x,1),0,@FWDSCAN) -1
   Next
   Return(dec)
#EndFunction

WM_HSCROLL = Hex2Dec(114)  ; Horizontal Scroll
WM_VSCROLL = Hex2Dec(115)  ; Vertical Scroll

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
; Create a temporary test file
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tmpfile = FileCreateTemp( 'Scroll' )
data = ''
For x = 0 To position
    If data == "" Then data = x
    Else data = data:@CRLF:x
Next
FilePut( tmpfile, data )
Run( appname, tmpfile )

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
; Scroll - Vertical
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
window1 = DllHwnd(title) ; Get top level handle
window2 = cWndbyclass(window1,`Edit`); cWndBySeq(window1,1); cWndByClass(window1,`Edit`) cWndByClass(window1,`MDIClient`)
If window1 && window2 ; Check if both windows are non xero
   For i = 0 To 100
      SendMessageA(window2, WM_VSCROLL , 1, 0)
   Next
EndIf

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
; Delete temporary test file
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
FileDelete( tmpfile )
Exit

Article ID:   W17987
Filename:   Mouse Scroll Using Windows Messages.txt
File Created: 2013:03:28:10:17:18
Last Updated: 2013:03:28:10:17:18