Close a card with a button (EdmCardFlag Enumeration)

Hello,

I want the card to save and close after it is done doing something triggered by a button.

I have obviously added a hook EdmCmdType.EdmCmd_CardButton to link my card button to perform this action.

Like described at the end of this example, it is possible to:

Close the card automatically after the button handler returns by setting the EdmCmdData::mlLongData1 variable to one of the EdmCardFlag constants.

Looking at the EdmCardFlag Enumeration, EdmCF_CloseDlgOK is exactly what I need.

My problem is that I can't figure out how to pass back this structure to the handler. I tried different things but none of them work.

With the following code I managed to change the value to 1 but nothing happens, the card does not close:

                    If pomd.mbsComment = "Test" Then

                        'Button "Test" clicked

                        poCmd.mbsComment = "OK"

                        MsgBox(DirectCast(ppoData(0), EdmCmdData).mlLongData1)

                        Dim pppoDataTemp As EdmCmdData = ppoData(0)

                        pppoDataTemp.mlLongData1 = 1

                        ppoData(0) = pppoDataTemp

                        MsgBox(DirectCast(ppoData(0), EdmCmdData).mlLongData1)

                    End If

Any suggestions?

Thanks!

SolidworksApi macros