The best time to check for the presence of your Key is when your program is NOT in the middle of doing something else. The reason for this is that you have to allow for the possibility of the Key not being present. If the Key is not present, then you should inform the Customer and provide the option of Retry or Cancel without having to deal with anything else.

Usually, a good time to check for the Key is when your program first starts executing before it has opened any files or databases. Another good time to call KeyChk is when the User starts a major program function, such as printing a report.

How often should you call KeyChk? Try to make this a realistic time limit to protect your Product without being overly paranoid. Calling KeyChk when the program starts up is fine for most programs. If your program runs all day, you might want to verify the presence of the Key every 15 minutes or between major operations. If your program performs a lot of different functions, then you might want to check for the presence of the Key before starting any of those functions.