I bumped into a little problem yesterday and before figuring out the, probably, correct way of exiting the Win32::GUI::Dialog() event loop by returning -1 from an event handler routine, I created this little hack to do it for me.

Now my question is if my way is a bad, evil thing or perhaps a clever way of using an undocumented feature :)

Here is the code (probably with weird line breaks):


=head1 CONSTANTS

=head2 WM_EXITLOOP
        
Custom message to exit from the Dialog() sub.
        
=cut
use constant WM_APP     => 0x8000;           #From winuser.h (Visual Studio)
use constant WM_EXITLOOP => WM_APP + 1;      #From GUI.xs


=head1 ROUTINES

=head2 exitDialog($winSomewindow)

Exit from the Win32::GUI::Dialog event loop.

$winSomewindow -- A Win32::GUI window object we can send the
WM_EXITLOOP message to.

Return 1 on success, else 0.

=cut
sub exitDialog {
        my ($winSomewindow) = @_;

        $winSomewindow->PostMessage(WM_EXITLOOP, -1, 0);

        return(1);
        }


Now, if this is in fact a healthy thing to do, is there any way of "broadcasting" it into the eventloop so I don't have to provide a window object?

And if this is a good thing, is there any hope of seeing this merged into Win32::GUI? Right now it lives in my very private Win32::GUI::AdHoc module.


/J
--
Johan Lindström, Sourcerer, Boss Casinos Ltd, Antigua
[EMAIL PROTECTED]


Reply via email to