Lock for a moveably, preferably pivotably mounted leaf of a door or a window, having a lock mechanism that can be attached on the leaf side, having a locking device (6, 7) and an actuating device (8, 8d), wherein it is provided that a) the locking device (6, 7) has a pivotably mounted latch on a moveably mounted bearing body, which has an inlet bevel and/or an outlet bevel and is formed in such a manner that the latch can engage in a strike plate that can be attached on the frame side to form a locking position and can disengage the strike plate to form an unlocking position, b) the locking device (6, 7) has a switch device which acts between the actuating device (8, 8d) and the latch for controlling the latch, and c) the latch cooperates with the switch device in such a manner that the latch can be brought into a non-pivotable position and a pivotable position, wherein the latch is in the locking position in the non-pivotable position, d) the locking device (6, 7) has a locking control member which can be moved by means of the actuating device (8, 8d), e) the switch device has a switch element cooperating with the locking control member and a latch blocking device cooperating with the latch, f) the locking device is formed as a locking bar device which has at least one locking bar along the closing edge of the leaf which is extendable and retractable for locking and unlocking via the actuating device (8, 8d), wherein the locking bar forms the locking control member by the locking bar cooperating at its free end with the pivotably mounted latch via the switch element, characterised in that the latch blocking device has at least one blocking element moveably mounted on the bearing body, said blocking element cooperating with the switch element to form a first relative position and a second relative position by the blocking element, in the first relative position, engaging in a recess of the latch in a blocking manner to form the non-pivotable position of the latch and, in the second relative position, not engaging in the recess of the latch or engaging in a non-blocking manner to form the pivotable position of the latch. a) the locking device (6, 7) has a pivotably mounted latch on a moveably mounted bearing body, which has an inlet bevel and/or an outlet bevel and is formed in such a manner that the latch can engage in a strike plate that can be attached on the frame side to form a locking position and can disengage the strike plate to form an unlocking position, b) the locking device (6, 7) has a switch device which acts between the actuating device (8, 8d) and the latch for controlling the latch, and c) the latch cooperates with the switch device in such a manner that the latch can be brought into a non-pivotable position and a pivotable position, wherein the latch is in the locking position in the non-pivotable position, d) the locking device (6, 7) has a locking control member which can be moved by means of the actuating device (8, 8d), e) the switch device has a switch element cooperating with the locking control member and a latch blocking device cooperating with the latch, f) the locking device is formed as a locking bar device which has at least one locking bar along the closing edge of the leaf which is extendable and retractable for locking and unlocking via the actuating device (8, 8d), wherein the locking bar forms the locking control member by the locking bar cooperating at its free end with the pivotably mounted latch via the switch element,