in reply to Win32: Can I interact with windows I didn't create?

The docs of Win32::GUI say as follows:
Non-owned windows

Every window, even windows not created by your Perl script, can be referenced by Win32::GUI; all you need to know is its "handle", a numerical value that identifies that window. Many functions in the Win32::GUI package return such handles, as for example:

$First = Win32::GUI::GetForegroundWindow();
This value can then be passed to any function that requires a window object; but of course, not being an object, you can't call it as a method:
Win32::GUI::Hide($First); # correct $First->Hide(); # wrong
Should you need to know the numerical handle of a window created by Win32::GUI, it is stored in its -handle key (this is the value that almost all function really use):
print "Window handle is $Window->{-handle} \n";

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Replies are listed 'Best First'.
Re^2: Win32: Can I interact with windows I didn't create?
by BobFishel (Acolyte) on Jan 16, 2009 at 20:58 UTC
    I've been searching for a way to detect a window if it is under the mousecursor but I haven't found a way.. any ideas?
        Awesome I've found a way to get the window I want now I'm trying to figure out how to get at the widgets in the window... there is a listbox which has several columns and I want to get the data in each column and I'm not sure how to do it because I don't have it's id or anything...