What is the best way to generate a serial number users can use to register an application?
I was thinking to the following scenario:
- Users try the application.
 - When they want to buy the application, they select a menu item.
 - The application generates a code that is then passed to the web site to buy the application.
 - Users enter the code returned from the web site.
 - The application checks the entered code with the code it generated.
 
If users lost the serial number, or copied the application after re-installing the OS, they would require the code to the website, which would return a special code that allow the application to get the original code generated for the users' machine.