Add a new platform in configuration management
1.1 create a new platform
The program was initially created based on the Pocket PC 2003 (ARMV4) platform. Based on the configuration of the platform, I created a new Win32 platform.
Open the menu Build-> Configuration Manager, select New from the Active Solution Platform drop-down box, select new as Win32, Copy settings from select the original Configuration Pocket PC 2003 (ARMV4 ), press OK to create a Win32 running platform for the application.
1.2 modify Debug | Win32 Configuration
The configuration of the Win32 platform is copied from PPC, and some parameters need to be changed. You can modify the project attributes, but modifying the project file directly is more intuitive and simple.
1.2.1 modify the PreprocessorDefinitions macro in the VCMIDLTool and retain only "_ DEBUG"
1.2.2 modify the PreprocessorDefinitions macro in the VCMIDLTool to "_ DEBUG; WIN32; _ WINDOWS"
1.2.3 modify the predefined macro PreprocessorDefinitions in VCResourceCompilerTool and retain only "_ DEBUG"
1.3 modify Release | Win32 Configuration
1.3.1 modify the preprocessordefinitions macro in the vcmidltool and retain only "ndebug"
1.3.2 modify the preprocessordefinitions macro in the vcmidltool to "ndebug; Win32; _ WINDOWS"
1.3.3 modify the predefined macro preprocessordefinitions in vcresourcecompilertool and retain only "ndebug"
2. Corrected compilation errors caused by platform differences
2.1 stdafx. h
The first is the definition of winver. It is defined as _ win32_wce under wince, and changed:
# If defined (wince)
# Define winver _ win32_wce
# Else
# Define winver 0x0501// Allows the use of features specific to Windows XP or later.
# Endif
# 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 special header files and libraries of WinCE, which are compiled only when the WINCE macro is defined (may be scattered in different locations ):
# If defined (WINCE)
# Include <ceconfig. h>
# Include <altcecrt. h>
# Include <aygshell. h>
# Pragma comment (lib, "aygshell. lib ")
# Endif
# If defined (WINCE)
# Include <ceconfig. h>
# Include <altcecrt. h>
# Include <aygshell. h>
# Pragma comment (Lib, "aygshell. lib ")
# Endif
2.2 App Type
In xxxapp: initinstance, the call of shinitextracontrols () is added with macro detection, which is compiled only when the wince macro is defined.
# If defined (wince)
// Shinitextracontrols shocould be called once during your application's initialization to initialize any
// Of the Windows Mobile specific controls such as capedit and sippref.
Shinitextracontrols ();
# Endif
3. In addition, the header file of the app class contains the definition of the resource file, which is encapsulated by the # ifdef standardshell_ui_model macro. My programs use the same resources on both platforms, so just comment out this macro.
4. linker entry point
5. Disable MFC to hide some common but often negligible warning messages.
# DEFINE _ afx_all_warnings
# DEFINE _ crt_secure_no_deprecate