You can use findProcessByExe("game.exe"). However, no. You do not attach by process ID. It goes per window. The attach() function only attaches keyboard/mouse input to that window's input thread, meaning that the game will have keyboard/mouse input send directly to it regardless of whether it is focused or not. So no, to your question, attached input would not mater when you are only trying to read and write memory.