Anyone can tell me if the Login\Logoff of users can be donne by code?!?!

Or by any type of command in the windows?!!