>>Is there a way in Perl to get a list of all the Windows applications >>that are running? Basically applications that show in the >>Alt-Tab list. >>I am just wondering if I can get the desktop coordinates of the >>respective windows applications. >> >>Any hint is appreciated. >> > > WMI is a good start, but I don't think it exposes the application screen > coordinates. > >
I could not find a way to get this info from WMI either. However, what I think you're really looking for are the coordinates for the top level windows, so there's no need for the processes. To do this, you need to use the following Windows API's: EnumWindows (uses a callback to identify each top-level window) GetWindowText (to get the title of the window) GetWindowInfo (returns a WINDOWINFO struct, which contains RECT rcWindow, which is what you're looking for) These API's are documented at Microsoft's MSDN library: http://msdn.microsoft.com/library. Basically, the EnumWindows callback is passed a window handle (hwnd) for each top-level window. The hwnd can then be passed to GetWindowText and GetWindowInfo to get the information you need about that window. This is easy enough in a language that can call Windows API's but this is beyond my current Perl skills. There's a Win32::API module that might do the trick, but I can't see how to do the callback with it. Perhaps an XS is the way to go, but that's beyond me right now, and perhaps way more complicated than simply using a language that can call Windows API's... Perhaps someone else on this list can use this info to craft the Perl you need... Good luck, HT _______________________________________________ ActivePerl mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
