TrueFaith wrote:game played in window, not full screen.
Don't know of anything that will help with this off the top of my head. GW2.exe doesn't have "focus". As I said, focus is not about applications, but about windows.
There is just no reliable way to use the "class" name of a window, which can be found, to identify which application opened that window. Some window classes are helpful. Notepad++.exe opens a window with a class of "Notepad++". An Explorer window opened by Windows has a class of "CabinetWClass". Not as helpful. The Manage window in Rainmeter has a class of "#32770". Not helpful at all.
The "title" of a window is even less reliable, as many apps don't have one, and if they do, nothing at all says they need to be unique.
I guess my point is that in spite of what it might feel like, there is no "external" relationship between an application and the windows it opens. The application itself knows what it opened of course, it was given a "window handle". Nobody else has insight into that relationship.