Thanks Rob,
Lesson learned.  I will try to exand on this tonight.  You rock!

Steve Lloyd
http://www.basgetti.com

> Steven Lloyd wrote:
>> Rob,
>> I have got this far but I cannot seem to get SetCapture to allow me to
>> go outside my window.  Any ideas?
>
> Steve,
>
> Please can we keep discussion on-list (unless they are OT) - others may
> be able to help, and may like to see the problems being solved.
>
> Read up about SetCapture at:
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/userinput/mouseinput/mouseinputreference/mouseinputfunctions/setcapture.asp
>
> You only continue to get mouse move events outside your window if a
> mouse button is depressed, so you'll need to catch a mouse down event,
> SetCapture(), process mouse moves and then ReleaseCapture() on the mouse
> up event (OK, this last step is not strictly necessary, as the system
> will do it for you).
>
> I was also wrong about the hit-hest idea - I think you'll need to use
> some combination of WindowFromPoint() and ChildWindowFromPoint() - I
> haven't looked to see if they're in Win32::GUI or not.
>
> Regards,
> Rob.
>
> #!perl -w
>
> # Left-Click on the target image, and drag
>
> use warnings;
> use strict;
>
> use Win32::GUI 1.0;
> use Win32::GUI::BitmapInline();
>
> my $mw = Win32::GUI::Window->new(
>       -name => "MainWindow",
>       -title => "Win32::GUI Spy++",
>       -pos => [100,100],
>       -size => [100,100],
> );
>
> my $cursor = get_cursor();
>
> $mw->AddLabel(
>       -name => "Target",
>       -icon => $cursor,
>       -notify => 1,
>       -onMouseDown => \&mouseDown,
>       -onMouseUp => \&mouseUp,
>       -onMouseMove => \&mouseMove,
> );
>
> $mw->Show();
> Win32::GUI::Dialog();
> exit(0);
>
> sub mouseDown
> {
>       my $label = shift;
>       Win32::GUI::SetCursor($cursor);
>       $label->SetCapture();
>
>       return;
> }
>
> sub mouseUp
> {
>       my $label = shift;
>       $label->ReleaseCapture();
>
>       return;
> }
>
> sub mouseMove
> {
>       my ($label, $x, $y) = @_; # x,y in client co-ordinates
>
>       return unless Win32::GUI::GetCapture();
>
>       Win32::GUI::SetCursor($cursor);
>       print "Mouse at: $x,$y\n";
>
>       return;
> }
>
> sub get_cursor
> {
>       return Win32::GUI::BitmapInline->newCursor( q(
> AAACAAEAICAAAA8AEAAwAQAAFgAAACgAAAAgAAAAQAAAAAEAAQAAAAAAAAEAAAAAAAAAAAAAAAAA
> AAAAAAAAAAAA////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHwAAAGDAAACbIAABQFAAApsoA
> AUAFAAECgQACoAqAAqgqgAIBAIACqCqAAqAKgAECgQABQAUAAKbKAABQFAAAJsgAABgwAAAHwAAA
> AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//////////////////////////////////g////g
> D///wAf//4gj//8YMf/+ODj//nx8//wMYH/8A4B//AOAf/wDgH/8DGB//nx8//44OP//GDH//4gj
> ///AB///4A////g///////////////////////////////////////8=
> ) );
> }
>
>
>


-- 
<a href="http://www.thetreasuredbox.com";>Hooded Bath Towels</a><br>



Reply via email to