Solved

Scroll "java window" via VB

Posted on 2006-06-10
5
420 Views
Last Modified: 2011-10-03
Hi,

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:
===========

knuddels.com (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 ?
0
Comment
Question by:vb_elmar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 14

Expert Comment

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

Author Comment

by:vb_elmar
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_MBUTTONDBLCLK = &H209  ' 521
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 :


URL:
http://www.autohotkey.com/forum/topic6772.html



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

; WM_MOUSEWHEEL
; WHEEL_DELTA = 120
SendMessage, 0x20A, 120 << 16, ( m_y << 16 )|m_x,, ahk_id %hw_m_target%
return
*********************************************************************************************



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

; WM_MOUSEWHEEL
; WHEEL_DELTA = 120
SendMessage, 0x20A, -120 << 16, ( m_y << 16 )|m_x,, ahk_id %hw_m_target%
return
*********************************************************************************************
0
 
LVL 14

Accepted Solution

by:
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.
0
 
LVL 17

Author Comment

by:vb_elmar
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.




Needs:
==========
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
Dim Pt As POINTAPI

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

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

'Value_of_the_high_order_word_of_wParam:
'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
0
 
LVL 14

Expert Comment

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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Adding to a VBA? 6 90
Protecting vb6 & .Net code Obfuscation 18 210
Passing a Text Box name to a Sub 6 104
Outlook Macro to delete emails not meeting keywords 56 111
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

737 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