N
N
NikitaZA2018-02-24 00:54:56
Qt
NikitaZA, 2018-02-24 00:54:56

Qt how to find out which application the user clicked on?

Hello, the idea is that when you click on a program (on any), we get its HINSTANCE. Next, we send her a message about changing her size. It is necessary to optimize the workspace.
The latter is not a problem. But how to catch the HINSTANCE of the window when clicking on it is not particularly clear. I haven't worked with winApi for a long time, and I haven't got into C++ either.
Because I decided not to strain too much, I decided to ask for advice right away. And yes, there isn't much time. So friends, poke your nose and make it harder to see for sure)))
Ps I was looking for a ready-made solution, I looked at 14 programs, not one does what you need.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Ananiev, 2018-02-25
@SaNNy32

Set a hook for the WH_MOUSE event via SetWindowsHookEx. Then, in the MouseProc callback procedure, the lParam parameter will contain a pointer to the MOUSEHOOKSTRUCT structure , from which the HWND of the window can be retrieved.
You don't need HINSTANSE for this task.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question