In the recent project, there was a program running on the WinCE platform, and later with the development of the project, the program was required to run on the PC as well.
Thanks to the multi-platform support offered by VS 2005, this problem can be solved in just a few minutes, the method is simple, and the following is the process I am dealing with. 1. Add a new platform in configuration Management 1.1 create a new platform
The program was originally created on the Pocket PC 2003 (ARMV4) platform, and I created a new WIN32 platform based on the configuration of this platform.
Open the menu build->configuration Manager, select New in the Active solution platform drop-down selection box, select New platform as win32,copy settings From the original configuration of the Pocket PC 2003 (ARMV4), press OK to create a new Win32 run platform for the application. 1.2 Modifying Debug| Configuration of the Win32
The configuration of the Win32 platform is replicated by PPC, and some parameters need to be changed. You can make modifications in the project properties, but it may be more straightforward and straightforward to modify the project file directly, and I will modify the file directly.
1.2.1 Modify the predefined macro preprocessordefinitions in tool VCMidlTool, leaving only "_DEBUG"
1.2.2 Modify the predefined macro preprocessordefinitions in tool VCMidlTool, change to "_DEBUG; Win32;_windows "
1.2.3 Modify the predefined macro preprocessordefinitions in tool VCResourceCompilerTool, leaving only "_DEBUG"
1.2.4 Modify the configuration of the tool VCLinkerTool, instead
- <tool
- Name= "VCLinkerTool"
- Linkincremental= "2"
- Generatedebuginformation= "true"
- Subsystem= "2"
- Targetmachine= "1"
- />
1.3 Modifying release| Configuration of the Win32
1.3.1 Modify the predefined macro preprocessordefinitions in tool VCMidlTool, leaving only "Ndebug"
1.3.2 Modify the predefined macro preprocessordefinitions in tool VCMidlTool, change to "NDEBUG; Win32;_windows "
1.3.3 Modify the predefined macro preprocessordefinitions in tool VCResourceCompilerTool, leaving only "Ndebug"
1.3.4 Modify the configuration of the tool VCLinkerTool, instead
- <tool
- Name= "VCLinkerTool"
- Linkincremental= "1"
- Generatedebuginformation= "true"
- Subsystem= "2"
- Optimizereferences= "2"
- Enablecomdatfolding= "2"
- Targetmachine= "1"
- />
2. Fix compiler errors caused by platform differences 2.1 stdafx.h
The first is the definition of winver, wince under the definition of _WIN32_WCE, change:
- #if defined (WINCE)
- #define WINVER _win32_wce
- #else
- #define WINVER 0x0501//allows the use of features specific to Windows XP or later.
- #endif
Then there are some wince-specific header files and libraries that, instead, are compiled only when wince macros are defined (possibly scattered in different locations):
- #if defined (WINCE)
- #include <ceconfig.h>
- #include <altcecrt.h>
- #include <aygshell.h>
- #pragma comment (lib, "Aygshell.lib")
- #endif
2.2 App Class
In Xxxapp::initinstance, the call to Shinitextracontrols () plus macro detection is compiled only if the WinCE macro is defined.
- #if defined (WINCE)
- Shinitextracontrols should be called once during your application ' s initialization-initialize any
- Of the Windows Mobile specific controls such as CAPEDIT and Sippref.
- Shinitextracontrols ();
- #endif
In addition, the application class header file contains the definition of the resource file, but was #ifdef Pocketpc2003_ui_model macro wrapped up, my program in two platforms all use the same resources, so this macro comment out.
Reference Link: http://blog.sina.com.cn/s/blog_7ffab91701016o5o.html
Http://wenku.baidu.com/link?url= Hhgo7jtpvedk3prtyofxxjeanbijk8g6k57coqanvrdu2evyerzu7om3foczqo63bg3ds3b28ij420k1pjiath7ojovjnin6mosk6p3wxdk
The WinCE Platform program compiles to the Win32 platform to run