VPE will send a Windows message to the application when the user clicks on the email button in the VPE preview window, which we route to an event. We have this working just fine:

In a subclass of the AppClientArea:

        Set External_Message VPE_BEFORE_MAIL to msg_OnVpeBeforeMail
And we have the following code which is executing in response:
        Procedure OnVpeBeforeMail Integer wParam Integer lParam Returns Integer
            tEmailMessage Email
            If (SYSFILE2.SMTP_SERVER<>'') Begin
                Object oEmailer is a cdtMailer
                    Set pbEditBeforeSending to True
                Move lParam to Email.hoDocument    //handle to VPE document
                Send DoSendEmail to oEmailer Email
                Send destroy to oEmailer
                Procedure_Return 1
            Procedure_Return 0
The goal here is to use SMTP to send emails (when it is set up by the user) rather than let VPE do the default of sending an email via MAPI.

The VPE documentation states:
Your application should return:
Value Description
0 continue operation
1 cancel operation i.e. do not mail the document

Cancelling the operation allows you to display your own mail dialog and/or to execute your own mailing code.
We've got the 0 and 1 return values in the separate procedure_return commands, but it doesn't appear to make any difference in testing; VPE always goes ahead and send the email via MAPI email anyway, even when our SMTP dialog appears and the email is sent out via SMTP and the "procedure_return 1" is executed.

Should we expect a procedure_return to be able to return a value to an external Windows message like this, am I doing something wrong in the procedure declaration maybe, or is this unusual usage?

(FWIW, the only case of an event returning a value that I found in the DF pkgs is in cAnimation, OnWmNcHitTest, which always does a procedure_return HTCLIENT.)