There are different ways to do it depending on if the client is online or if it has to be offline, and using a dongle or not (Uncommon today).
If the client will be online you can just do an API call and check on start, if there's no key show a splash screen with the option of entering a key.
If there IS a key, send it (securely) to the API and do something depending on the result.
Here's a good article for how you could do it for offline keys: https://www.brandonstaggs.com/2007/07/26/implementing-a-part...
It's written for Delphi/Object Pascal but the principles can be implemented in any language.