use strict; use warnings; use Data::Dumper; 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} = $pci->sizeof(); Win32::API->Import("user32", "BOOL GetCursorInfo(PCURSORINFO pci)"); print Dumper($pci); # before, empty but for cbSize my $result = GetCursorInfo($pci) or die $^E; # DIES HERE, RESULTS BELOW print Dumper($pci); # after, hopefully full of useful information