I'm trying to make a transparent screensaver in C++ and WinAPI.
It works fine so far on Windows XP, but on WES7 I have the following problem:
By making my screen transparent, I can't recieve any WM_MOUSMOVE
messages.
SetWindowLongPtr( hWnd,
GWL_EXSTYLE,
GetWindowLongPtr(hWnd, GWL_EXSTYLE) | WS_EX_LAYERED | WS_EX_TOOLWINDOW );
double TransparencyPercentage = 50.0;
double fAlpha = TransparencyPercentage * ( 255.0 /100 );
BYTE byAlpha = static_cast<BYTE>( fAlpha );
SetLayeredWindowAttributes( hWnd, 0, byAlpha, LWA_ALPHA );
I already got the information, that byAlpha
has to be bigger than 0, because I won't recieve any mouse messages otherwise, but I still recieve keyboard messages, as well as mouseclicks.
Hope you can help me with this.
WM_MOUSEMOVE
and it worked fine. Does this code work properly? – chrisWM_MOUSEMOVE
messages are only generated if the message queue is empty. If you are posting lots of messages you may never fully deplete the message queue to have aWM_MOUSEMOVE
message generated the next time you callGetMessage
. – IInspectable