Source code is protected by not showing it to anyone who shouldn't see it. What you're probably looking for is a way to protect your distributable binaries. For that, I suggest Ansel Reynard's article on the matter
. Even if you're not working in .NET, the article should give you a good idea of what to do in general. Also see the related article
by the same author about creating trial versions of your application.