[python-win32] better way to get current process's name
Tim Golden
mail at timgolden.me.uk
Thu Feb 22 18:21:35 CET 2007
Kelie wrote:
> for every 0.1 second, check the active application or current
> application, or active window? (I don't know what is the correct
> term.) if it is AutoCAD (meaning user is using AutoCAD), turn on the
> CapsLock, if it is Microsoft Word (meaning user is using Word), turn
> off the CapsLock.
Well your best bet is to look at WATSUP:
http://www.tizmoi.net/watsup/intro.html
or at pywinauto:
http://sourceforge.net/projects/pywinauto
but I'm not convinced that what you're trying to do is
A Good Thing ;)
> Oh, the reason I check the active application for every 0.1 second is
> I don't know how to do it otherway. Is there an event that
> corresponds to the active application/window change?
It's a long while since I did lowish-level Windows stuff in earnest.
I suspect you'd have to install a system message hook and look for
WM_ACTIVATE messages or something similar. Perhaps someone more
knowledgeable here can chip in...?
TJG
More information about the Python-win32
mailing list