如何使用他的HWND检查窗口是否有可见的滚动条? [英] How I can check if a Window has visible scrollbars using his HWND?

查看:292
本文介绍了如何使用他的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天全站免登陆