Are you talking about protecting the actual code of the program from being pirated or the program itself? If it just the code itself, you can prevent prevent the program from being decompiled back into usable code by obfuscation or simply write your program in another language that is impossible to decompile such as C++. On the other hand, if it's the program that you want to protect from being pirated then there is no foolproof way to do it. Even the software giant Microsoft can't protect there software from being pirated, so don't feel too bad if you can't for your little program.