in reply to Inspecting messages using Win32::API

This is called a "call back" and you can't do it with Win32::API. Go grab the FFI.pm module (and yell at ActiveState and/or IndigoStar if they still don't have a binary version of this module for you).

The second argument would need to be of type "N", not "P" (Win32::API's "P" is mostly only useful for '\0'-terminated strings), and would need to be the address of a C subroutine (well, it could be a subroutine in any number of languages provided that it follows the appropriate Win32 calling conventions, which means it can't be a Perl subroutine).

You can also use FFI.pm instead of Win32::API for accessing arbitrary subroutines from DLLs (or other types of shared libraries since FFI.pm is portable, very much unlike Win32::API). I'm not a big fan of the some aspects of the design of Win32::API anyway, though I suspect I'll find that FFI.pm and C::Dynalib (the other portable replacement for Win32::API that also existed before it) have their own things that annoy me once I use them enough.

        - tye (but my friends call me "Tye")
  • Comment on (tye)Re: Inspecting messages using Win32::API