News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Scrolling another app

Started by Javer, September 17, 2007, 12:58:29 PM

Previous topic - Next topic

Javer

Hi all
I need to scroll third party app. But I have a problem. When I scroll scrollBar, the scroll bar is scrolled but the window is not.
When I click, on the scroll pointer, window is immediately scrolled.
This is my code:

    mov ebx,7152   ;identifier of control
    invoke GetDlgItem,ADD_HANDLE, ebx
    mov ScrollHandle,eax
    invoke SetScrollPos,ScrollHandle,SB_CTL,28,TRUE


When I scroll it normally, I mean by clicking with mouse, not by this code, everything is ok.
Any Idea ?

Javer
Ps: sorry for my english

evlncrn8


Javer

thanks for reply.
I'm not able to make setfocus work. It still ends with the NULL.
Any other solution ?

Javer

I can make it work when I set the cursor to the current position X and Y and click


invoke  SetCursorPos,950,300
Invoke mouse_event,MOUSEEVENTF_LEFTDOWN,950,300,0,0
Invoke mouse_event,MOUSEEVENTF_LEFTUP ,950,300,0,0


But I don't like this solution becouse, the user can move the window and then the position x = 950 and y = 300 is useless.
Is there any other way how to send Scroll bar pointer click ?
Please if somebody know help me.

Javer

zooba

Try calling UpdateWindow on the parent window after setting the scroll bar position. Also, if the scroll bar is an automatically provided one (ie. the window was created with WS_HSCROLL or WS_VSCROLL) you will need to pass SB_HORZ or SB_VERT instead of SB_CTL.

Cheers,

Zooba :U

Javer

No UpdateWindow doesn't work  :(   With SB_HORZ or SB_VERT it did nothing. The SB_CTL is correct. Actually it doesn't scroll anything. It just moves scroll pointer (thumb) to the position. But window isn't scrolled.
It looks like this :


and it should be :


thanks

hutch--

Javer,

The technique you posted above is probably your best bet.


invoke  SetCursorPos,950,300
Invoke mouse_event,MOUSEEVENTF_LEFTDOWN,950,300,0,0
Invoke mouse_event,MOUSEEVENTF_LEFTUP ,950,300,0,0


Much of the API code you have access at is not designed to work across two different threads so you may nopt have the correct access to make many of them work. With the code you have above you should properly calculate the windows location every time you run the code and you will not have the problem you mentioned of the user moving the window.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Javer

Ok so i try to use GetWindowRect and calculate it.
Thank everybody for effort

MichaelW

Javer,

I can't tell from the image exactly what you are attempting to scroll, but if it is a control, you may be able to force a scroll by sending it an appropriate message, and let it handle the scroll bar, etc. I have tested this on a list-view control, the MASM32 example by Ewayne Wagner, and the message is LVM_SCROLL. I also tried scrolling an Explorer window, and even though the class name is the same, SysListView32, Send Message always returns ERROR (under Windows 2000 SP4).
eschew obfuscation

Javer

It's scroll bar. Class Name is ScrollBar.
I tried to send various messages like LVM_SCROLL or WM_VSCROLL but with no success

MichaelW

The images show what appears to be a list of some sort, with a scroll bar that I think is probably a child of the control that contains the list. It is this control that I think you should target. Determine what it is, and then determine if there is a documented method of scrolling it. I posted an app here that may help you to identify the control(s).

eschew obfuscation