After some trouble installing OpenCV 2.4 in Windows and using it with Visual C++ 2010, I decided to write a post about this, so I can hopefully save you some time figuring this one out. It is based on this wiki, but that describes how to build with CMake etc, which is not necessary (anymore?).
Okay, so first you need to download OpenCV 2.4 here. After downloading, you need to extract it. I have extracted it to "D:\OpenCV2.4.2\" and I will use this folder for the rest of this post, you can change it if you like.
Edit your PATH variable (right click on this computer, properties, then select the tab "advanced" and click on "Environment Variables", which is near the bottom).