Win32/api GetWindowText

Hello all,

I’m using win32/api. I was using GetForegroundWindow to get the window
on top. Then I wanted to use GetWindowText to get the ‘title-bar’ text.
I just couldn’t figure it out.

So, I google for win32/api documentation, and found one where it
enumerates through all processes and returns the GetWindowText. My
browser - Mozilla Firefox - as well as quite a few other applications
didn’t show up properly. A few did, though.

How can I

  1. Get the current ‘caption’ or ‘title-bar’ text of the foreground
    window.
  2. Is there a better way than GetWindowText? It doesn’t work for many
    applications so I’m wondering.

Thanks!