Savva Mikhalevski
Savva Mikhalevski

Reputation: 327

How to scroll the scrollbar in external application via WinAPI?

Description

I'm trying to test application coded in Delphi (VCL components by DevEx) with TestComplete. Application is built without debug info.

I need to scroll TcxTreeList component. The problem is when I set Position property for this component's scrollbars content is not scrolled but scroll bar position changes. I tried a lot of approaches and suppose that WinAPI can help me.

The Question:

How to scroll the scrollbar in external application via WinAPI?

I found PostMessage function, but I do not know how to synthesize WM_SCROLL message...

Upvotes: 1

Views: 2007

Answers (1)

Sertac Akyuz
Sertac Akyuz

Reputation: 54802

Scroll one line down (you can see other constants at the page JustBoo mentions);

PostMessage(HWnd, WM_VSCROLL, SB_LINEDOWN, 0)

Scroll to a specific position;

PostMessage(HWnd, WM_VSCROLL, MakeWParam(SB_THUMBPOSITION, 30), 0)


But if you refer to this page on the Devex forums, it is mentioned that "ScrollBar in the cxTreeList it is another control, not standard windows scrollbar". So it might not work. In this case you might want to try ScrollWindowEx coupled with setting the position as you already do.

Upvotes: 1

Related Questions