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 ?

The best solution (compatible with any host) is either to add a button to ā€œinsert password from clipboardā€ or to automatically add the content from the clipboard when the user clicks into the password field.