检测非标准滚动条
有没有办法用 WinAPI 检测窗口是否有非标准滚动条(例如,窗口可以自己绘制滚动条而不是使用标准滚动条)?
Is there a way to detect with WinAPI if window has non-standard scrollbars (for example, window can draw scrollbars itself instead of using standard ones)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不太确定这是否有效,但这只是一个想法。
滚动条属于必须在启用此样式的情况下创建的窗口。因此,您可以检查您的窗口是否包含 WS_VSCROLL 样式,如果是,则这是标准滚动条。相反,它是由其他人绘制的。
您可以通过以下方式检查:
I'm not quite sure if this will work, but it is just an idea.
Scroll bars belong to the window which has to be created with this style enabled. So, you can check if your window contains WS_VSCROLL style and if so - this is standard scrollbar. In counterpart it is drawn by somebody else.
You can check it on this way:
很难看出你是如何做到这一点的。控件可以在自己的画布上绘制滚动条,进行自己的命中测试,您怎么可能知道。您无需为滚动条创建单独的 HWND 即可完成所有这些操作。
如果你能说出你为什么想知道这一点,那就更有趣了。
It's kind of hard to see how you could do this. A control could just paint scroll bars in its own canvas, do its own hit testing and how would you possibly know. You could do all this without creating separate HWNDs for the scroll bars.
What would be more interesting would be if you could say why you would wish to know this.