This worked to disable F4 function key (close window key) on Lenovo laptop.

Meaning the F4 key will not close window, but call default F4 action.

Install Auto Hot Key and create new .ahk script with content:

;f4 and alt f4 switch
sleep 30
send {F4}
Use AhkCompiller to convert script into .exe and run this .exe after Windows start, it will prevent Close function of the F4 key and instead call default F4 function.

I did it on Windows 10 but should work for all Windows.

You can also download already compilled .exe here:!Vg92FYaB!4hhwNswnriy1LadsBXTg8B3Utvo9arA6zZclur7 nm-8