问题
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?
回答1:
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.
来源:https://stackoverflow.com/questions/31518114/ws-ex-transparent-and-stylus-events