Scroll "java window" via VB

Posted on 2006-06-10
Last Modified: 2011-10-03

how can i use a vb timer (interval e.g. 900) to send a
"scrolldown" or a "scrollup" to a "java chat window".

The URL is:
=========== (chat with java window)

(Easy immediate registration. No confirmation mail will
be sent to your email address. -You don't need a valid eMail address.)

(annotation: to scroll the java chat window up and down
you can use the "mouse wheel" .)

-But my question is: How can I scroll the window by code ?
Question by:vb_elmar
  • 3
  • 2
LVL 14

Expert Comment

ID: 16877951
That is not possible in any way.
LVL 17

Author Comment

ID: 16879721
'Window Messages

WM_MOUSEMOVE = &H200       ' 512
WM_LBUTTONDOWN = &H201   ' 513
WM_LBUTTONUP = &H202         ' 514
WM_LBUTTONDBLCLK = &H203   ' 515
WM_RBUTTONDOWN = &H204    ' 516
WM_RBUTTONUP = &H205         ' 517
WM_RBUTTONDBLCLK = &H206   ' 518
WM_MBUTTONDOWN = &H207   ' 519
WM_MBUTTONUP = &H208        ' 520
WM_MOUSEWHEEL = &H20A      ' 522

User 'shimanov' posted a sample how to send mouse scrolls
to window under mouse.

It should work under Win98+
-But the sample is in Delphi :


MouseGetPos, m_x, m_y
hw_m_target := DllCall( "WindowFromPoint", "int", m_x, "int", m_y )

SendMessage, 0x20A, 120 << 16, ( m_y << 16 )|m_x,, ahk_id %hw_m_target%

MouseGetPos, m_x, m_y
hw_m_target := DllCall( "WindowFromPoint", "int", m_x, "int", m_y )

SendMessage, 0x20A, -120 << 16, ( m_y << 16 )|m_x,, ahk_id %hw_m_target%
LVL 14

Accepted Solution

StillUnAware earned 500 total points
ID: 16879785
Java created window is not native Windows window, it is Java Virtual Machine specific one, You can't interact with inner scrolls in it.
LVL 17

Author Comment

ID: 16919158
Now i translated user shimanov's code to vb6 (see working sample below).

With the sample i can send a "virtual_mouse_wheel_rotation"
to the window under the mouse.

The vb6 sample works with notepad, word, IE and other programs.

-But as you mentioned - it doesn't work with a Java created window. So your answer
is correct, and i'll give you the 500 points.

1 Timer

Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long

Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long

Private Type POINTAPI
x As Long
y As Long
End Type

Const WHEEL_DELTA = 120: Const WM_MOUSEWHEEL = &H20A

Private Sub Form_Load()
    Timer1.Interval = 977
End Sub

Private Sub Timer1_Timer()
    GetCursorPos Pt
    hw_m_target = WindowFromPoint(Pt.x, Pt.y)
    Caption = Pt.x & " " & Pt.y & " " & hw_m_target
    m_x = Pt.x + 10: m_y = Pt.y

Dim lParam As Long, wParam As Long

wParam_low_Part% = 0 'low Word =Send a virtual [Shift,CTRL] Left_mouse button,Middle_mouse button,Right_mouse button

'wParam_high_Part% =  1 * WHEEL_DELTA 'send_mouse_wheel_rotation UP      [+1] = scroll up
 wParam_high_Part% = -1 * WHEEL_DELTA 'send_mouse_wheel_rotation DOWN [-1] = scroll dwn

    wParam& = wParam_low_Part + wParam_high_Part * 2 ^ 16
    SendMessage hw_m_target, WM_MOUSEWHEEL, wParam, lParam
End Sub
LVL 14

Expert Comment

ID: 16921572
Thanks for the points, although I wasn't very helpful :)

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Controlling which port to download from 4 71
Input past end of file vbs script 9 81
Paint/Redraw window while dragging 16 68
Set email body to html using vbscript 6 22
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now