Hi guys! I'm pretty new at python (well...who isn't actually?) and I;ve been trying to do a little something for a project of mine.
Whenever a user plays a computer game (like fallout or whatever), that game becomes the foreground window doesn't it? What I'm trying to do is locate the path of this game and search for a file inside the .exe folder...I know it sounds ambitious...but I really hope you guys can help me on this: Here's a bit of code I've been trying to use but I keep getting the 'Invalid handle error"
__________________________________________________ ________________
import win32gui
import win32api
from time import sleep
sleep(0)
w = win32gui
handle = w.FindWindow(0,str(w.GetWindowText(w.GetForeground Window())))
lala = win32api.GetModuleFileName(handle)
print lala
__________________________________________________ ________________
Any help you guys can offer would be much appreciated!! Thanks!