Sample code for 30+ languages & platforms
DataFlex

Transition from Email.GetAttachedMessage to Email.GetAttachedEmail

Provides instructions for replacing deprecated GetAttachedMessage method calls with GetAttachedEmail.

Chilkat DataFlex Downloads

DataFlex
Use ChilkatAx-win32.pkg

Procedure Test
    Boolean iSuccess
    Handle hoEmail
    Integer iIndex
    Variant vEmailObj
    Handle hoEmailObj
    Variant vEmailOut
    Handle hoEmailOut
    String sTemp1
    Boolean bTemp1

    Move False To iSuccess

    Get Create (RefClass(cComChilkatEmail)) To hoEmail
    If (Not(IsComObjectCreated(hoEmail))) Begin
        Send CreateComObject of hoEmail
    End

    // ...
    // ...
    Move 0 To iIndex

    // ------------------------------------------------------------------------
    // The GetAttachedMessage method is deprecated:

    Get ComGetAttachedMessage Of hoEmail iIndex To vEmailObj
    If (IsComObject(vEmailObj)) Begin
        Get Create (RefClass(cComChilkatEmail)) To hoEmailObj
        Set pvComObject Of hoEmailObj To vEmailObj
    End
    Get ComLastMethodSuccess Of hoEmail To bTemp1
    If (bTemp1 = False) Begin
        Get ComLastErrorText Of hoEmail To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    // ...
    // ...

    Send Destroy of hoEmailObj

    // ------------------------------------------------------------------------
    // Do the equivalent using GetAttachedEmail.
    // Your application creates a new, empty Email object which is passed 
    // in the last argument and filled upon success.

    Get Create (RefClass(cComChilkatEmail)) To hoEmailOut
    If (Not(IsComObjectCreated(hoEmailOut))) Begin
        Send CreateComObject of hoEmailOut
    End
    Get pvComObject of hoEmailOut to vEmailOut
    Get ComGetAttachedEmail Of hoEmail iIndex vEmailOut To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoEmail To sTemp1
        Showln sTemp1
        Procedure_Return
    End



End_Procedure