I have a form which I make click-through using the following function calls:
SetWindowLong(Handle, GWL_EXSTYLE, (IntPtr)(GetWindowLong(Handle, GWL_EXSTYLE) ^ WS_EX_LAYERED ^ WS_EX_TRANSPARENT));
SetLayeredWindowAttributes(Handle, 0, 0xFF, LWA_ALPHA);
This works fine, however when I try to fade that window using the System.Windows.Forms.Form.Opacity
property I get the following exception:
System.ComponentModel.Win32Exception (0x80004005): The parameter is not valid
at System.Windows.Forms.Form.UpdateLayered()
at System.Windows.Forms.Form.set_Opacity(Double value)
How can I achieve both things at the same time?