in api, how to cancel user change state request?

Hi,

I need to do some checking when user change state, and I write some code in EdmCmdType.EdmCmd_PreState session, now, when the checking fails, how can I cancel the user change state request? does api support it? Please help, thanks a lot.

Best regards,

Andrew

SolidworksApi/macros