In general you can lock units with certain weapons with RMB (right mouse button)
or Tab key.
If you add a displayAddEventhandler to the standard game display (46),
you can easily disable any key action:
AAS_KeyHandler = compile(preprocessFileLineNumbers "keypress.sqf");
(findDisplay 46) displayAddEventHandler ["KeyDown","_this call AAS_KeyHandler"];
_keypressed = _this select 1;
if (_keypressed in actionKeys "ForceCommandingMode") then {_return = true;};
_return