I think that Win32::GUI is the right way, and GetForegroundWindow() gives you the window handle of the window currently having the focus :
perl -MWin32::GUI -wle "print Win32::GUI::GetForegroundWindow()"
In reply to Re: find active window
by Corion
in thread find active window
by Foggy Bottoms
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |