I am trying to send keystrokes to a window/s that is not in focus using sendmessage. Finding the window's handle using its name is simple enough, however what I want is to get the handle by clicking on the window or puting that window into focus (whichever is easier) bec. I have multiple copies of the window open at the same time with the same name & I want to be able to choose which one of those I send the keystrokes to by clicking/focusing (then minimizing after so i can work on another window).

I've tried google however I can't seem to find an example related to what i want to do. Found some stuff about getting the handle by hovering, but the code was in C#. Any help please? Thanks in advance. :)

nevermind, i just found out that findwindow will take the handle of the last window that took focus. :)