Using Google Code Search to Find Sample Code

21 Oct 2011

Google Code Search is a search engine specific for software source code. It is a great tool for programmers to find sample code for any API function that you don’t know how to use.

For example, recently I need to know how to get the PE header of a DLL file. I found the ImageNtHeader Win32 API but had no idea how to use it after reading the MSDN doucment. To fully understand how to use it, I need a working sample code. So I search in Google Code Search with the following keywords: ImageNtHeader lang:c++, and suddenly I got tons of samples about using ImageNtHeader, even it is a rarely used API.

If you’ve never used Google Code Search, you can start to learn how to use it. By using various search criteria, you can learn all kinds of coding techniques from many high quality projects.