I tried the VB code, converted to Perl and using Win32::API. (the code isn't the tidiest in the world, I've missed out most of the program):
...
use Tk;
use Win32::API;
# Windows constants
my ($OnTop, $NoTop, $Top) = (-1, -2, 0);
my ($SWP_NOMOVE, $SWP_NOSIZE) = (2, 1);
...
# Create a Win32::API object for SetWindowPos
my $SetWindowPos = new Win32::API("user32", "SetWindowPos", [N,N,N,N,N
+,N,N], N);
...
my $w = new MainWindow;
...
# do the 'always on top' bit
my $hwnd = $w->frame; # frame returns a hex value as a string, e.g. "0
+x1234"
print "$hwnd\n";
$SetWindowPos->Call(hex($hwnd), $OnTop, 0, 0, 0, 0, $SWP_NOMOVE | $SWP
+_NOSIZE);
MainLoop;
Unfortunately $w->frame returns the Tk MainWindow, not the Win32 window containing it. As a result setting $w->frame 'always on top' doesn't have any effect.
Anyone know how to get an HWND for a window's parent out of Win32? Tk::Wm's $w->wrapper doesn't work either.
--
Kevin O'Rourke