Fundamentally, you can't. And form of security can be broken if enough effort is put into it: look at how quickly a new version of PhotoShop appears in "cracked" form on the pirate sites after it is released by Adobe - the same day in some cases. And you can bet it cost Adobe a lot more time and money than that to implement copy protection...
There are some things you can do, but you need first to decide what benefit / investment ration you want to support. If you are selling the application for a couple of dollars, and expect to sell a hundred copies with the same number pirated, then you can't put much into it before you have cost yourself more than you will save. And bear in mind that it's not the number of copied versions in use that matters, it's the number of copied versions that will be paid for instead: so if you prevent 100 copies, but only 10 of them are converted to sales, then only (10 - 1) times the profit should have been invested in the protection, or you have lost money getting those sales. And if your copy protection annoys one customer into demanding his money back - and it can, and does if you don't get it exactly right - then that counts against the number of converted copies as well. It doesn't take long before it costs you a lot more to implement copy protection than you get back from it...
Having said that, google can help you:
Google "copy protect my application"[
^] - I leave it to you to work out the best method for your particular circumstances.