Press key & Commnd C + V and etc

#include <Carbon.h>

  Boolean isPressed(unsigned short inKeyCode)
  {
      unsigned char keyMap[16];
      GetKeys((BigEndianUInt32*) &keyMap);
      return (0 != ((keyMap[ inKeyCode >> 3] >> (inKeyCode & 7)) & 1));
  }

if(isPressed(kVK_Return))
        {
          // Thanks for the answer it gives an understanding of the work under the hood
        }

Does it make sense to implement this code, it works like Logic pro, Cubase, Reaper on Mac ?