Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm setting WS_EX_TRANSPARENT flag in window with the following code:

SetWindowLong( hwnd, GWL_EXSTYLE,WS_EX_TRANSPARENT | WS_EX_COMPOSITED | WS_EX_LAYERED );

This flag make that mouse events go to windows system instead of my app. When I set this, I can't get Stylus events in hwnd window. Any way to solve that or that's not possible?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
888 views
Welcome To Ask or Share your Answers For Others

1 Answer

The behavior for the WS_EX_TRANSPARENT extended window style for Layered Windows is documented:

[I]f the layered window has the WS_EX_TRANSPARENT extended window style, the shape of the layered window will be ignored and the mouse events will be passed to other windows underneath the layered window.

Note: The rules for input handling are usually the same, for all pointing devices. Whenever you read "mouse events" you can expand that to "input events from a pointing device".

One workaround is given in the documentation for WS_EX_TRANSPARENT:

To achieve transparency without these restrictions, use the SetWindowRgn function.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...