# Use this to monitor the shape of mouse cursor use strict; use warnings; use Win32::API; Win32::API::Struct->typedef( POINT => qw{ LONG x; LONG y; }); Win32::API::Struct->typedef( PCURSORINFO => qw{ DWORD cbSize; DWORD flags; HCURSOR hCursor; POINT ptScreenPos; }); my $pci = Win32::API::Struct->new('PCURSORINFO'); $pci->{cbSize} = 20; #$pci->sizeof(); # ? sizeof doesn't work for nested struct ? Win32::API->Import("user32", "BOOL GetCursorInfo(PCURSORINFO pci)"); while (1) { my $result = GetCursorInfo($pci) or die $^E; print "Current mouse shape is $pci->{hCursor}\n"; $pci->{cbSize} = 20; sleep 1; }