I write a lot of code that is published in books, magazine articles, and blog entries. Sometimes I receive emails requesting permission to use this code in commercial products or other programming projects.
All the code that I write and publish is free to use in your software projects without restriction. I write the code primarily for pedagogical purposes, but if you find a chunk that suits your needs, just take it. Use it straight up or modify it, I don't care. That's what it's there for!
The copyright notice that often appears on my source code is intended to assert my rights regarding publication of the source code. For example, you can't take some of my source code and put it in your own book or magazine article.
Even so, there are several circumstances in which republication of my source code is permitted under "fair use" concepts. For example, if you're writing an article and you need to discuss some stupid blunder that you found in one of my code samples, you're allowed to republish the code. I've seen some old code I've written used in historical discussions about the horrors of Win16 programming. That's OK as well.
Sometimes people want to translate code from my books to other programming languages. I like to know about such projects, but I have no problem with that. Currently, folks on the Visual Basic Team at Microsoft are converting samples in my book Applications = Code + Markup to VB. The results are here:
If you ever feel you need to say "Thank you" for the code, you can do so by buying my next book.