Mayowa has asked for the wisdom of the Perl Monks concerning the following question:

hello everbody, is there any way for me to obtain win32 events in perl eg WM_LBUTTON and is there any way of writing win32 event handlers in perl thankx, mayowa

Replies are listed 'Best First'.
Re: Events In Win32
by jplindstrom (Monsignor) on Jun 30, 2001 at 13:42 UTC
    It depends on what you want to do with the message. Win32::GUI is probably the right tool (it might have exactly what you need already), but since that's a bit vague...

    I suspect that if you state what you want on a higher level of abstraction, Win32::GUI will be useful in some way, at least as the proper base to build on.

    Get both the PPM and the source distribution with the docs and stuff.

    http://sourceforge.net/projects/perl-win32-gui

    If you decide to go with Win32::GUI, this mailing list is highly recommended:

    http://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users

    /J

Re: Events In Win32
by bikeNomad (Priest) on Jul 01, 2001 at 00:03 UTC
    Events like WM_LBUTTON are meaningless outside of a GUI. So you have to also make the window, and have a Windows event loop. There's a few solutions for this, including Tk, Win32::GUI, and (maybei) Gtk. Tk and Gtk also provide Perl wrappers for most of the Windows widgets, and add some useful ones of their own. When you use Tk, setting up a callback for something like WM_LBUTTON is as simple as passing a subroutine reference to a constructor.

    1 I'm not sure whether anyone's been successful getting Gtk-Perl to work on Win32; the basic Gtk libs are available (as is Gimp). Should be do-able, but I haven't seen anyone say they've done it.

Re: Events In Win32
by Chady (Priest) on Jun 30, 2001 at 12:02 UTC

    never done that before, but I'm sure you'll find something at libwin32, lots of modules there...

    maybe the Win32::Event?? don't even know what it does..


    He who asks will be a fool for five minutes, but he who doesn't ask will remain a fool for life.

    Chady | http://chady.net/
Re: Events In Win32
by MZSanford (Curate) on Jun 30, 2001 at 12:27 UTC

    I have thought about this before, but never really done much work on it. I can think of a couple possiblities, but it really depends why you want the event. If this is GUI based, most Perl GUI work is done via Tk. If you don't want to use Tk, i think Win32::GUI makes a good stab at windows native GUI functionality.

    For non-gui events, the only real answer would be to write an XS module for the functionality you need. Thats no small task. If you don't mind, please post the message you are looking for and why ... i might come up with something else.


    may the foo be with you