Search code examples
windowsvisual-studio-2012win32-process

xx is not a valid win32 application


I developed a Win32 program using VC++ 2012 (Express 2012 for Windows Desktop). I chose "Win32" / "Win32 Console Application" while setting up my project. I can run it at Win-7, but failed at POSReady 2009, which is close to WinXP. While I ran it under POSReady 2009, it shows as title. Is there any way to configure project property on VC++2012 or any other ways to conquer it? Thanks.


Solution

  • You need to install VS 2012 Update 1 or later or VS 2013 Express, and set your Platform Toolset to "v110_xp" or "v120_xp" to make an application that is compatible with Windows XP Service Pack 3 / Windows Server 2003 Service Pack 2).

    The key difference between the "v110"/"v120" and "v110_xp"/"v120_xp" Platform Toolset is the Windows SDK. "v110"/"v120" builds with the Windows 8.x SDK which supports targeting Windows Vista or later. It is not possible to build a Windows XP compatible application using the Windows 8.x SDK. Therefore, to target Windows XP / Windows Server 2003 you have to use the alternative Platform Toolset which uses the Windows SDK 7.1A which is included with Express for Windows Desktop.

    With either Windows SDK, be sure to set _WIN32_WINNT appropriately for the OSes you are targeting. See Using the Windows Headers. For Windows XP / Windows Server 2003 set it to _WIN32_WINNT=0x0501

    Note that for DirectX development, this has some important impacts because the Windows 7.1 SDK was before the DirectX SDK integration that was done for the Windows 8.x SDK. See this blog post for more details.