CreateWindow/CreateWindowEx Win32 function behaviors on Windows 7/Visual Studio 2012 differently from Windows 7/Visual Studio 2010.

This happened to me when I migrated my Visual Studio 2010 project files to Visual Studio 2012. The same code didn’t work in the same way it used to work with Visual Studio 2010. I found that if I change the tool set to v110 (Visual Studio 2010), the code works ok. I also found, however, that the target .NET framework is always 4.0 regardless the tool set version.

To my gut feeling, the new Visual Studio uses a different Windows SDK/.Net Framework which is targeted to Windows 8.

I tried to change the target framework by modifying the existing project files as well as creating new ones with .Net Framework 4.5 selected. I referred to this article, but could not find the tag instructed to modify. Instead I modified the following line, but it didn’t help.

<Project DefaultTargets=”Build” ToolsVersion=”4.5″ xmlns=”″&gt; …

When I tried to create a new project with .NET Framework 4.5, it didn’t really use 4.5, but 4.0 according to the property page. Maybe .NET Framework 4.5 is not installed in my machine, and Visual Studio 2012 should work with 4.5… Also refer to this article, which seems the most relevant to my problem and may help.

In conclusion, just fall back to the old 2010 tool chain (v100) to work around this problem.