我怎么能检查一个窗口有可见的滚动条使用他的HWND? [英] How I can check if a Window has visible scrollbars using his HWND?

查看:105
本文介绍了我怎么能检查一个窗口有可见的滚动条使用他的HWND?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想检查外部应用程序的窗口是否有垂直或水平滚动条可见使用窗口的HWND(句柄),存在任何WinApi函数以获取此信息?我真的尝试 GetScrollInfo 函数,但似乎没有检索有关滚动条的可见性的信息。

I want to check if the window of an external application has the vertical or horizontal scrollbar visible using the HWND (handle) of the window, exist any WinApi function to get this information? I really try the GetScrollInfo function but it seems that not retrieve information about the visibility of the scrollbars.

推荐答案

如何 GetScrollBarInfo OBJID_HSCROLL OBJID_VSCROLL


如果 idObject 是OBJID_CLIENT,并且由hwnd指定的窗口不是系统滚动条控件,系统会将SBM_GETSCROLLBARINFO消息发送到窗口以获取滚动条信息。这允许GetScrollBarInfo在模仿滚动条的自定义控件上操作。如果窗口不处理SBM_GETSCROLLBARINFO消息,则GetScrollBarInfo函数失败。

If idObject is OBJID_CLIENT and the window specified by hwnd is not a system scroll bar control, the system sends the SBM_GETSCROLLBARINFO message to the window to obtain scroll bar information. This allows GetScrollBarInfo to operate on a custom control that mimics a scroll bar. If the window does not handle the SBM_GETSCROLLBARINFO message, the GetScrollBarInfo function fails.

您可以在 rgstate /msdn.microsoft.com/en-us/library/windows/desktop/bb787535%28v=vs.85%29.aspx> SCROLLBARINFO 结构,

You can test rgstate in the SCROLLBARINFO structure, there is a STATE_SYSTEM_INVISIBLE flag there.

另一种可能的方式是在其中加入 STATE_SYSTEM_INVISIBLE 以测试 GetWindowLong(hWnd,GWL_STYLE)和(WS_HSCROLL或WS_VSCROLL)<> 0

Another possible way is to test GetWindowLong(hWnd, GWL_STYLE) and (WS_HSCROLL or WS_VSCROLL) <> 0

这篇关于我怎么能检查一个窗口有可见的滚动条使用他的HWND?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆