Here's a quick check to find out if you need piracy protection software. Start with the bittorrent sites and search for your executables. If you find cracked versions, you need piracy protection. Next, google "buy [your product name here]." If websites come up selling your product for a big discount, but you've never heard of them, you need piracy protection software. Those are very possibly bad guys selling counterfeit copies of your product...customers will think they are legit, and they they are getting a great price. Sound implausible? Think again...we have customers with exactly this problem.
Frankly there's no easy way to write your own protection software against piracy. Some things are much better left to professionals. Would you create your own firewall or anti-virus software? Of course not. It makes no sense to try to create your own software where the stakes are so high and the knowledge is so specialized.
Instead, check out CodeMeter, the most secure piracy protection software available. You can add complete protection to your application and data files in as little as a few minutes. And keep the guys in the black ski masks at bay.