Stealing the solution from:
http://www.codeguru.com/forum/showthread.php?t=352963
I made it happen the other way round so that I still had a close button
that I could use - but you'll get the idea.
Regards,
Rob.
#!perl -w
use strict;
use warnings;
use Win32::API;
use Win32::GUI();
my $SetWindowPos = Win32::API->new("user32","SetWindowPos", "LLLLLLL", "L")
or die "Failed to load SetWindowPos";
sub TME_HOVER() {1}
sub TME_LEAVE() {2}
sub HOVER_DEFAULT() {0xFFFFFFFF}
sub SWP_FRAMECHANGED() {32}
sub SWP_NOMOVE() {2}
sub SWP_NOSIZE() {1}
sub SWP_NOZORDER() {4}
sub SWP_NOACTIVATE() {16}
my $state = 0; # 0 - out; 1 - in;
my $mw = Win32::GUI::Window->new(
-title => "Vanishing Title Bar",
-pos => [100,100],
-size => [400,300],
-onMouseOver => sub {print "Hover\n"; return 0;},
-onMouseOut => \&Out,
-onMouseMove => \&Move,
);
$mw->Show();
Win32::GUI::Dialog();
exit(0);
sub Out
{
print "Out\n";
$mw->Change(-pushstyle => WS_CAPTION),
$SetWindowPos->Call($mw->{-handle}, 0, 0, 0, 0, 0,
SWP_FRAMECHANGED|SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE);
$state = 0;
return 0;
}
sub Move
{
return unless $state == 0;
$mw->Change(-popstyle => WS_CAPTION),
$SetWindowPos->Call($mw->{-handle}, 0, 0, 0, 0, 0,
SWP_FRAMECHANGED|SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE);
print "In\n";
$state = 1;
$mw->TrackMouse(1000,TME_HOVER|TME_LEAVE);
return 1;
}
__END__
Brian Millham wrote:
I forgot to attach the code. (I always seem to do that :-)
Brian Millham
This message traveled at least 44,000 miles to reach you!
Creator of the DW6000 Monitor
http://www.millham.net/dw6000
[EMAIL PROTECTED]
-----Original Message-----
From: Brian Millham [mailto:[EMAIL PROTECTED]
Sent: Wednesday, February 01, 2006 7:04 PM
To: '[EMAIL PROTECTED]'
Subject: Hiding/showing the title bar on a window
Hi all,
I'm playing with creating a normal window that only shows the titlebar when
the mouse is over the window. (The code is based on hover code that Rob sent
yesterday)
The titlebar seems to be removed logically, but not on the screen. If you
move the mouse over the window, and then back out, the titlebar buttons
(minimize, maximize and close) no longer work. If you resize the window,
the titlebar disappears. It does not appear when the mouse is over the
window.
I've tried using InvalidateRect(1) to force a redraw of the window, but this
doesn't work.
Any ideas, or am I trying to take a simple approach to a more complicated
problem.
Brian Millham
This message traveled at least 44,000 miles to reach you!
Creator of the DW6000 Monitor
http://www.millham.net/dw6000
[EMAIL PROTECTED]
---
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 0605-4, 02/01/2006
Tested on: 2/1/2006 7:04:09 PM
avast! is copyright (c) 2000-2003 ALWIL Software.
http://www.avast.com
---
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 0605-4, 02/01/2006
Tested on: 2/1/2006 7:34:55 PM
avast! is copyright (c) 2000-2003 ALWIL Software.
http://www.avast.com