To get the state of a given user, call the XUserGetState function. The function accepts a pointer to an XUserState enumeration as an argument.To monitor changes in the state of a user, subscribe to XUserChangeEvent by calling XUserRegisterForChangeEvent.