Work accumulation: programs on the WinCE platform are compiled to run on the Win32 platform.

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.