in reply to Re^2: Win32 Keyboard hook in perl
in thread Win32 Keyboard hook in perl

Ok now please enlighten me on the proper way to create a pointer with the win32::api mod. I tried what the docs said exactly, $foo = " " x 80;

Replies are listed 'Best First'.
Re^4: Win32 Keyboard hook in perl
by Mr. Muskrat (Canon) on Sep 10, 2004 at 04:18 UTC

    $hooker = $hook->Call($idHOOK, $lpfn, $hmod, $dwThreadId);

    IIRC, $lpfn is supposed to be a reference to a subroutine so that it can be used as a callback.

      Eh, what?!? No, a callback expects a pointer to some raw machine code (generally compiled C), which the CPU can then execute directly. Pure Perl won't do, you'll need an interface layer written in XS.

      I looked over CPAN, and found Win32::API::Callback, which probably can be used to get the desired effect. If it doesn't crash. :)

        I was speaking of the underlying API but I should have said that. I probably should have left it at "The API expects that position to hold a pointer to a callback function."