[python-win32] better way to get current process's name
Roger Upole
rwupole at msn.com
Thu Feb 22 19:02:51 CET 2007
Kelie wrote:
> Thank you Tim and Mark. After trying what was suggested by you (both
> work), I realized it is not what I was looking for. What I wanted to
> do is: 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.
>
I think win32gui.GetForegroundWindow is what you're looking for.
>From the MSDN docs:
The GetForegroundWindow function returns a handle to the foreground window (the window with which the user is currently
working).
hth
Roger
More information about the Python-win32
mailing list