如何通过 WinAPI 在外部应用程序中滚动滚动条? [英] How to scroll the scrollbar in external application via WinAPI?
问题描述
说明
我正在尝试使用 TestComplete 测试在 Delphi 中编码的应用程序(DevEx 的 VCL 组件).应用程序是在没有调试信息的情况下构建的.
I'm trying to test application coded in Delphi (VCL components by DevEx) with TestComplete. Application is built without debug info.
我需要滚动 TcxTreeList 组件.问题是当我为此组件的滚动条设置 Position
属性时,内容未滚动但滚动条位置发生变化.我尝试了很多方法,并认为 WinAPI 可以帮助我.
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.
问题:
如何通过WinAPI在外部应用中滚动滚动条?
找到了PostMessage函数,但是不知道怎么合成WM_SCROLL消息...
I found PostMessage function, but I do not know how to synthesize WM_SCROLL message...
推荐答案
向下滚动一行(你可以在 JustBoo 提到的页面看到其他常量);
Scroll one line down (you can see other constants at the page JustBoo mentions);
PostMessage(HWnd, WM_VSCROLL, SB_LINEDOWN, 0)
滚动到特定位置;
PostMessage(HWnd, WM_VSCROLL, MakeWParam(SB_THUMBPOSITION, 30), 0)
但如果您参考 此页面在 Devex 论坛上,有人提到cxTreeList中的ScrollBar是另一个控件,不是标准的windows滚动条"
.所以它可能不起作用.在这种情况下,您可能想尝试 ScrollWindowEx 再加上像你已经做的那样设置位置.
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.
这篇关于如何通过 WinAPI 在外部应用程序中滚动滚动条?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!