简体   繁体   中英

Detect non-standard scrollbars

如果窗口具有非标准的滚动条(例如,窗口本身可以绘制滚动条而不是使用标准的滚动条),是否可以使用WinAPI进行检测?

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:

// Assume that a window handle hWnd is known
int style = GetWindowLong(hWnd, GWL_STYLE);
BOOL bStandard = ((style & WS_VSCROLL) != 0);

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM