Hi All!
Is anybody know how to get the following result: The best I want to make left mouse button pressed and then get series event send to the application. Quite similar to that of onMouseMove events. I noticed that the system knows the event onMouseOver, but it does not perform any method.
Here is my button where onMouseMove acts whereas onMouseOver doesn't:
my $b = $mw->AddButton(
-name=> 'name',
-pos => [ $left , $top ],
-size => [ $width, $height ],
-popstyle => WS_CAPTION | WS_EX_TRANSPARENT | WS_SYSMENU | WS_THICKFRAME | WS_BORDER,
-remexstyle => WS_EX_CLIENTEDGE,
-onMouseDown => \&::mousedown,
-onMouseRightDown => \&::mouserightdown,
-onMouseRightUp => \&::mouserightup,
-onMouseOver => \&::mouseover,
-onMouseMove => \&::mousemove,
);
I have found in Internet the following code (later on), but I don't see any efects of MouseOver at all. Specialy it does not print the words: "Hover" when I put my mouse over the window. Can anyone help me? I use Perl 5.8.
the code:
#!perl -w
use strict;
use warnings;
use Win32::API;
use Win32::GUI qw(WS_CAPTION);
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;
}
|