Hey guys,
Another quick question. I'm still trying to do the thing in the email below.
But this time im trying to use the win32api.GetModuleFileName function. It
requires a PyHandle as an input which I think I've managed to get by using the
function handle = w.FindWindow(0,str(w.GetWindowText(w.GetForegroundWindow())))
where handle would serve as the input to the win32api.GetModuleFileName
function and w = win32gui. However I'm getting a 'the handle is invalid' error.
Something I'm doing must be wrong. I figure if I can get the filename
associated with the open window, I can just run a search for it through python.
I'm sure there is an easier way to perform the stuff in the email below though.
Could any of you guys please help me out with this? Thanks.
Regards,
Sudheer
PS: Is there a way to use GetFullPathName to find the path of the .exe file?
From: sudheer...@hotmail.com
To: python-win32@python.org
Subject: Trying to grab exe of foreground window
Date: Tue, 21 Jul 2009 10:48:19 +0800
Hi guys,
Normally I’m able to find the answers I’m looking for on the net…but this time,
either I haven’t searched hard enough or no one has attempted this before, so I
would really like to request some help with this. I’m trying to write a program
to locate the directory of the .exe of the foreground window and search for a
file within that directory...I know this sounds ambitious but I believe there
has to be a way to do it. So far, all I've managed to do is grab the name of
the foreground window. Oh yeah, I'm pretty new to python actually...about 3
weeks into learning it. Any help you guys can provide would be greatly
appreciated!!
Thanks!!
Regards,
Sudheer
With Windows Live, you can organize, edit, and share your photos.
check out the rest of the Windows Live™. More than mail–Windows Live™ goes way
beyond your inbox. More than messages
_________________________________________________________________
With Windows Live, you can organize, edit, and share your photos.
http://www.microsoft.com/malaysia/windows/windowslive/products/photo-gallery-edit.aspx
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32