PDMWorks Enterprise password popup

Does anybody have some sample code that prompts the user forhispassword whenever the document transfers from one state toanother?If password is not correct then the document should notchangestate...SolidworksApi macros