I can give a little bit more information to add to what Corion has already said. This will be
much faster if you chase it through the windowing system. The downside is that the app will be less portable, but I infer from your question that you're in Windows regardless of where you want to be.
So on to the meat. First, every window on the screen (and some not) in Windows has a Window Handle. This is a long int that you can use to have a conversation with the OS about a window. Given a window's handle, you can access all of the content of the window, including the title, any text fields, and any buttons. (This is a handy way to send a 'click' message to a button, and it's like the user clicked it.)
Once the Perl app has the process ID, it can wander the list of windows for that process, start asking for handles, and examining window titles. (Titles are good for error messages, because they're usually consistent even when the error message itself varies.)
Some things that might help:
The people at
http://sysinternals.com/ write really useful Windows utilities. "Handle" and "Process Explorer" might help here.
Microsoft publishes all of their APIs on the web, you just have to dig to find them. Start with http://msdn.windows.com, and choose
library. The API calls that will get you started are
FindWindow (Find a top-level window)
FindWindowEx (find a child window) and
GetWindowText.
This will not result in pretty or interesting code, but it will be so much faster than a graphics approach.
I'd post a sample, but all of my hacking on this was done a few years ago, for a former employer, in Visual Basic. :(
--
Spring: Forces, Coiled Again!