'How to recover the semi-transparent Window where the mouse click through?

I want to recover the Window that I set the semi-transparent to 50% where the mouse is.

I can't get this Window handle from the mouse pointer for its Click-Through. And if I don't set click trough, it is easy to solve.

The following steps from this topic may be a solution, but it will hide the semi-transparent Window. So is there a better way to get the semi-transparent Window information, and then to show it transparent 100%?

Temporarily hide my form (OR, temporarily set my form's opacity to 0.0)
Call [GetCursorPos][1]
Call [WindowFromPoint][2]
Show my form again

If there is one Window, I can store the Window handle where the mouse is and then recover it, but I want to set more than 1 Window transparent to 50% and recover them one by one with the mouse pointer.

Recover the mouse with the semi-transparent Window by the stored handle using WinAPI.

var WS_EX_LAYERED = 0x80000;
var WS_EX_TRANSPARENT = 0x20;
var GWL_EXSTYLE = (-20);
SetWindowLong(hWnd, GWL_EXSTYLE, GetWindowLong(hWnd, GWL_EXSTYLE) & (~WS_EX_TRANSPARENT));

If I store the handle of the Windows that will be set the transparency to 50% in an array, I can't recognize which one handle is match the Window where the mouse pointer.

It is just a Windows Desktop Program to do the function above through Shourcuts. As I said, it is easy except add the mouse Click Trough. The Window may be a normal program like the Explorer, Notepad, and so on, and maybe Winforms, I find it is hard to be used on the normal program, and also it will be good if the function with Click-Trough suits for more than 1 Window like Winforms.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source