Qt how to find out what the app is clicked the user?

Hello, the idea is when you click on the program (any) will get its HINSTANCE. Then sent her a message about a change in its size. Need to optimize working space.
To do the latter is not a problem. But how to catch the HINSTANCE of the window when you click on it don't know much about. Have not worked with winApi and With++ did not climb.
Because we decided not to strain , I decided to ask advice from. And time is worth that. So friends poke nose but stronger that would just saw )))
P. s looking for a turnkey solution , looked at 14 programs no one does what you need.
June 7th 19 at 15:46
1 answer
June 7th 19 at 15:48
Using SetWindowsHookEx to install a hook for WH_MOUSE event. Then, in the callback procedure MouseProc the lParam parameter will contain a pointer to a structure MOUSEHOOKSTRUCTfrom which you can get the HWND of the window.
HINSTANSE you don't need for this task.

Find more questions by tags WindowsC++Qt