This function will allow you to make a window unfocusable. An unfocusable window can be interacted with, but not focused. Also, it doesn't appear in the Alt-Tab window list, nor does it appear in the Taskbar.
I use this on my Gaim Buddy List so that it doesn't get in the way when I'm Alt-Tabbing around.
use Win32::API;
use Win32::GuiTest 'FindWindowLike';
use constant SW_SHOW => 0x5;
use constant SW_HIDE => 0x0;
use constant GWL_EXSTYLE => -20;
use constant WS_EX_NOACTIVATE => 0x8000000;
sub unfocusable_window {
my $win = shift;
my ($hwnd) = FindWindowLike(undef, $win)
or die "Couldn't find window $win\n";
my $style = GetWindowLong($hwnd, GWL_EXSTYLE);
$style |= WS_EX_NOACTIVATE;
ShowWindow($hwnd, SW_HIDE);
SetWindowLong($hwnd, GWL_EXSTYLE, $style);
ShowWindow($hwnd, SW_SHOW);
}
sub focusable_window {
my $win = shift;
my ($hwnd) = FindWindowLike(undef, $win)
or die "Couldn't find window $win\n";
my $style = GetWindowLong($hwnd, GWL_EXSTYLE);
$style &= ~WS_EX_NOACTIVATE;
ShowWindow($hwnd, SW_HIDE);
SetWindowLong($hwnd, GWL_EXSTYLE, $style);
ShowWindow($hwnd, SW_SHOW);
}