For one of my projects, I need to create a function that will return a handle to a window when the user click on it (any window displayed on screen, and anywhere inside that window).
I know it is possible to use a global hook, but I think there must be a more simple way of doing that, without using any DLL injection.
In fact, I could intercept the left mouse click or intercept when a window is activated.
Can I use one of those 2 solutions without any DLL injection?
You could use a LowLevelMouseProc hook to intercept the click, and then use WindowFromPoint to determine the window. (I haven’t actually tried this.)