Maybe someone will be interested...
1. Software
I recommend putting all tools in one folder. C:\Program files\Utility\ in my examples (same on both PC)
2. Preparation
Turn off second (slave) PC or pull out video cable connector from monitor or PC.
Run ControlMyMonitor on first (master) PC and remember the following data:

monitor name and input select value.
Turn on second PC, switch monitor and turn off first PC
Run ControlMyMonitor on second PC and remember same data
3. Input Director setting
On first (master) PC
assign hotkey to return input to first PC
assign hotkey to set input to second PC
turn on Logitech keyboard compatibility mode
not important settings, but...
there is nothing special in the ID settings on the second (slave) PC
4.Make switch buttons
On first (master) PC
Create batch file SwitchPC.bat in tools folder.
where "\\.DISPLAY1\Monitor0" - monitor name from ControlMyMonitor from first PC, "17" - input select value from first PC and "18" - input select value from second PC,
"^^!2" (Ctrl+Alt+2) - hotkey sequence to set input to second PC
Make shortcut (switch button) for nircmd.exe on desktop and edit it
add exec and hide keys and SwitchPC.bat batch file as parameters
click on shortcut and you should switch to the second PC...
On second (slave) PC
Run PsExec.exe and accept EULA
Create batch file SwitchPC.bat in tools folder.
where "\\.DISPLAY1\Monitor0" - monitor name from ControlMyMonitor from second PC, "18" - input select value from second PC and "17" - input select value from first PC,
"\\phoenix" - network name of first PC, "^^!1" (Ctrl+Alt+1) - hotkey sequence to return input to first PC
Make shortcut (switch button) just like for the first PC
Congratulations you did it.
Thanks for attention and sorry for my bad english.