1

I just need some code that will return a string of the name of the current activated window title/name.

I've spent almost hours looking for a simple example though...

================================================================

I've seen other people say to hook windows messages and listen for wm_activate, and others...

I already have when to check, I just need something like...

print window.name.current
>> Get Current Active Window Title/Name - Python - Mozilla Firefox

3
Contributors
4
Replies
8
Views
8 Years
Discussion Span
Last Post by Shadow14l
Featured Replies
  • Windows calls this the "Foreground Window". It might not be the one your program is running. [ICODE]HWND GetForegroundWindow(VOID); [/ICODE] Once you have the HWND you can call [ICODE]GetWindowText(hWnd,outbuf,outlen)[/ICODE] to get the title bar contents. I assume pywin32 supports these calls, but haven't looked them up. Read More

1

Windows calls this the "Foreground Window". It might not be the one your program is running. HWND GetForegroundWindow(VOID); Once you have the HWND you can call GetWindowText(hWnd,outbuf,outlen) to get the title bar contents.

I assume pywin32 supports these calls, but haven't looked them up.

Comments
good point
0

It doesn't support those, I was looking for a module, or another method to do that.

This question has already been answered. Start a new discussion instead.
Be sure to adhere to our posting rules.