Abstract: The method for locking a computer and a device for the same are provided. The proposed locking method for a computer includes steps of: (a) providing a detecting tool to monitor a mode; and (b) detecting a removal of the mode via the detecting tool so as to lock the computer thereafter. The proposed computer having a locking function includes a detecting tool detecting a triggering signal, and a receiving device receiving the triggering signal and locking the computer accordingly.