I am attempting to make one window stay in front of another window always.
The window on top has the Always On Top attribute set to True. When the window behind loses focus I am disabling the Always on top using
Win32.SetWindowPos(getChatHandle(pid), (IntPtr)Win32.SpecialWindowHandles.HWND_NOTOPMOST, 0, 0, 0, 0, Win32.SetWindowPosFlags.SWP_NOMOVE | Win32.SetWindowPosFlags.SWP_NOSIZE | Win32.SetWindowPosFlags.SWP_NOACTIVATE);
I tried replacing with the HWND_BOTTOM also, that has the tendency of hiding the window that should be on top.
The HWND_NOTOPMOST leaves the window on top, on top of the newly selected window witch is not desired.
I think WM_INACTIVE works fine the problem originated as described above.
Original question:
I have found the WM_ACTIVATE message, it receives wParam to indicate if it is active(also for mouse) or inactive.
The problem occurs on WA_INACTIVE it doesn't trigger as expected.
It occurs if another window is clicked in the taskbar, or a simple click on the window title section.
It doesn't occur if the user clicks another window client area, one of the system buttons (minimize, maximize, close), or clicks without releasing.
PS: I considered using the style changed, for when it loses the active window drawing style, that does trigger, unfortunately I haven't found out which flag determines that.
Thank you.