'''This page is mostly deprecated''' it was started for a Project to port Kdepim to Windows CE. All additional patches / cross compile techniques can be found in emerge from the KDE - Windows initative.

−

+

Binaries for Windows Mobile 6.5 and a source tarball of Kontact Touch (an optimized variant of KDEPIM software for Touch enabled devices) can be found at:

Although Windows CE (officially called Windows Embedded CE) is part of the Windows Embedded family there is a large difference between Windows Embedded CE and other Windows Embedded products. Most importantly Windows CE is not Windows. It has a different Kernel then any other Windows Operating System. And while other embedded products like Windows Embedded Standard or Windows Embedded Enterprise (which are sized down versions of Windows XP) will run Windows applications without problems, Windows CE applications require porting even from Windows.<br>

+

Windows Mobile then is based on Windows CE (CE has no official meaning) and it's current Versions Windows Mobile 6.1 (and 6.5) are based on Windows CE 5.2 so we will be talking about developing for Windows CE 5.2 when we are talking about developing for Windows Mobile 6.1 or 6.5.

+

It is confusing but Windows Mobile 6 is '''not''' based on Windows CE 6 so it still has the limitations of Windows CE 5. For example the process address space is still limited to 32 MiB and the maximum Number of processes can not exceed 32.

−

=== Notes about the port: (by Maurice Kalinowski) ===

+

===Process limit===

+

Confirmed on HTC Touch Pro (Wimo6.5 CE 5.2.21854)

+

running:

+

for(i=0;i<32;i++){

+

if(CreateProcess(L"test1.exe",(LPCWSTR)cptr,0,0,0,0,0,0,0,&procinf))

+

fprintf(file,"Process Nr.%i ID: %u started\n",i,procinf.dwProcessId);

+

else

+

fprintf(file,"Creation failed after %i processes\n",i);

+

}

+

I was able to create 16 processes at most after a fresh boot. (32 alltogether, including kernel thread)

+

===Memory limit===

−

- Project page: http://cegcc.sourceforge.net/

+

The Memory limitations on Windows CE < 6 are a serious Problem. Additionally to the limitations that are normal for embedded development, you have to deal with limitations on the address room.

CreateProcess must get both first arguments, name and cmdline. In contrast to Windows NT (and Unix), cmdline must not repeat the name of the executable as argv[0]. Instead, argv[0] is filled in from the module name, and cmdline fills the arguments starting from argv[1].

+

+

The only handles that can be duplicated to other processes are Mutexes, Semaphores and Events. These can also simply be opened by their name from different processes for a similar effect. No way to pass File or other handles from one process to another! Must use socketpair (named object by port) or custom device driver (named object by device).

+

+

ExitProcess is missing. ExitThread from main thread terminates the whole process!

+

+

== Device Setup for Windows Mobile for Development ==

+

Getting started with development for Windows Mobile you may want to install some additional Software, enabling you to get more control over your System then the standard UI of Windows Mobile provides.

+

+

==== Task Manager ====

+

''' This should be your first step '''

+

Without this tool (or something similar) it is impossible to even kill processes or start programs with command line Arguments. It should be the first thing you install because you need it (or something similar) to install and work with the other Tools.

+

+

You can download a CAB-Installer at http://www.dotfred.net/TaskMgr.htm

It allows you to view and change installed certificates and the general

+

security configuration on your device, so you can disable them for development.

+

You have to install it on a Windows machine with Active-Sync connection, though.

+

+

==== Registry Editor ====

+

http://ceregeditor.mdsoft.pl/ is a good choice when you want to worked for me, although it is not Open Source it is small, clean, free of charge and does the job. It connects with the device and allows you to edit and search the Registry remotely from a Windows Machine.

+

+

A small, on device, registry editor is also included in the Task Manager.

+

+

+

+

== Building Qt for Windows CE with MSVC ==

+

+

==== Setting up Visual Studio<br> ====

+

+

First thing you need is Visual Studio professional or standard edition (preferably with service pack 1). Be aware that the express editions are explicitly not supported for Windows CE development.<br> (You could use [http://www.microsoft.com/downloads/details.aspx?FamilyId=1DACDB3D-50D1-41B2-A107-FA75AE960856&displaylang=en%20 Microsoft Embedded VC] which is cost-free, but deprecated and not supported by Qt) <br>Next thing you need is a Microsoft Windows Mobile Platform SDK corresponding to your target platform. Just search the Microsoft download pages or get the Windows Mobile 6 SDK from [http://www.microsoft.com/downloads/details.aspx?FamilyID=06111A3A-A651-4745-88EF-3D48091A390B&displaylang=en here] (You should take a loot at the System Requirements)<br>If everything is set up correctly you should now be able to create a “Visual C++ smart device" project in Visual Studio.<br>

+

Note on Version-Naming: Standard means without touchscreen, Professional means with Touchscreen and Classic means Windows Mobile without mobile phone capabilities<br>

+

+

More about Visual Studio and Windows Mobile development: http://msdn.microsoft.com/en-us/library/dd721907.aspx

+

<br>

+

+

==== Building Qt ====

+

+

Download the Qt libraries for Windows CE from http://qt.nokia.com/downloads/win-ce-cpp and extract it, you may want to make sure that your path contains no blanks to avoid some problems.

+

+

Now you should add your <tt>&lt;qt-directory&gt;\bin</tt> to your Windows <tt>PATH</tt> environment variable (which can be done from “''Control Panel → System → Advanced →Environment variables''”, user and system <tt>PATH</tt>s are merged by Windows).

+

+

Next get up your Visual Studio Command Prompt which should be accessible from the Windows Start Menu. Change the working directory to qt-directory and start the configuration. There should be a <tt>configure.exe</tt> in your qt-directory with the usual options, (<tt>configure.exe -help</tt> for more info) for cross compiling you need to give at least the <tt>-platform</tt> parameter with your host system and <tt>-xplatform</tt> with your cross-compile target. Supported platforms are listed in the <tt>README</tt> file. e.g.:

Now that your configuration is set you can start the cross compilation. To switch from your “normal” build environment to the wince target Qt has a nice script included in the <tt>/bin</tt> directory (which should be in your <tt>PATH</tt>): just try calling <tt>setcepaths</tt> and provide your target configuration.

+

setcepaths wincewm65professional-msvc2008

+

(if this complains that it cannot find <tt>checksdk.exe</tt>, you are building out-of-source (shadow builds in Qt lingo) and you need to add <tt>&lt;builddir&gt;\bin</tt> to <tt>PATH</tt>, too, then re-run the script).

+

With <tt>nmake</tt> (Visual Studio version of make) you can now build Qt for your target system.

+

+

== Building Qt for Windows CE with CeGCC ==

+

+

==== Getting CeGCC ====

+

+

[http://cegcc.sourceforge.net/ CeGCC] (http://cegcc.sourceforge.net/) is a free cross-development environment for ARM-based systems running Windows CE. It is not officially supported by Qt and work with it is highly experimental, but given some work it could be possible to use it to build KDE-applications for Windows Mobile.

+

+

You should build cegcc from source, see: http://cegcc.sourceforge.net/docs/build-toolchain.html the current release 0.59 has some major bugs which were fixed since.

+

+

<br>

+

+

==== Building Qt ====

+

+

Maurice Kalinowski at Nokia did some work on this and provided a working Qt-Version with make specs for mingw32ce that make it possible to build most of the Qt parts. The original mailing-list thread discussing this can be found here: http://lists.trolltech.com/pipermail/qt-wince-interest/2009-November/000764.html

+

+

Link to the gitorious repository: http://gitorious.org/+qt-developers/qt/ce-gcc

+

+

After downloading you should take a look at the cegcc_configure script, maybe change the installation prefix there and then execute it. If your configuration fails make sure that your environment is not yet set for cross-compiling.

+

+

When configuration is complete you can build the host-tools, just go into your checkout and execute: <br> {

- when you are compiling your application outside of the Qt tree, you might

−

get into trouble related to mkspecs and include dirs.

−

- for deployment you need to copy these files also to the same directory on the device:

libgcc_s_sjlj-1.dll

libgcc_s_sjlj-1.dll

libstdc++-6.dll

libstdc++-6.dll

which are located inside the arm-mingw32ce directory

which are located inside the arm-mingw32ce directory

+

+

<br>

+

+

== Packaging: ==

+

+

=== Deploying Qt Windows Mobile Applications using LCAB ===

+

+

LCAB is a free software utility, that has the ability to create Microsoft CAB archives. You can get it on ( http://packages.debian.org/lenny/lcab )or as a Debian package.

+

+

With the creation of cabinet archives as a prerequisite, the question is how to get Windows Mobile to recognize them as install packages. Its basically a way in which the files have to be ordered and named inside the archive combined with a setup.xml file with installation instructions. There is a Perl script to add the needed manifest and setup configuration file. You can find it under ( http://files.intevation.de/incoming/aheinecke/cab_files/pocketpc-cab.pl )

+

+

This script needs a configuration file (two if you want to install registry keys, also), but it is much more simple and straightforward then the Cabwiz variant. Simply write down for every file you want to package a line a file:

+

+

Filename Target-Directory [Shortcut Name] [Shortcut Folder]

+

for example:

+

collidingmice.exe %CE1%/Colliding_Mice "Colliding Mice" %CE11%

+

msvcr90.dll %CE2%

+

QtCore4.dll %CE2%

+

QtGui4.dll %CE2%

+

+

This installs collidingmice.exe to Program Files/Colliding_Mice , places a shortcut in the Start Menu folder and copies the libraries into the Windows directory.

+

+

==== CE Variables ====

+

+

Here are some predefined Windows CE variables which can be used to identify a path on a Windows CE device.

+

+

&nbsp;%CE1% \Program Files

+

&nbsp;%CE2% \Windows

+

&nbsp;%CE4% \Windows\StartUp

+

&nbsp;%CE5% \My Documents

+

&nbsp;%CE6% \Program Files\Accessories

+

&nbsp;%CE7% \Program Files\Communication

+

&nbsp;%CE8% \Program Files\Games

+

&nbsp;%CE11% \Windows\Start Menu\Programs

+

&nbsp;%CE12% \Windows\Start Menu\Programs\Accessories

+

&nbsp;%CE13% \Windows\Start Menu\Programs\Communications

+

&nbsp;%CE14% \Windows\Start Menu\Programs\Games

+

&nbsp;%CE15% \Windows\Fonts

+

&nbsp;%CE17% \Windows\Start Menu

+

+

=== Deploying Windows Mobile Applications using Cabwiz ===

+

+

Maybe in some situations Cabwiz has its relevance, (e.g. you only want to build from windows) but even then i would suggest to directly edit the setup.xml that is included in the Cabinet file to suit your needs.

+

Before i found lcab i wrote a guide on [http://files.intevation.de/incoming/aheinecke/cab_files/creating_cab_files.odt how to Package a simple Qt-Application with cabwiz]

+

+

== Building KDE-Apps for Windows CE using MSVC ==

+

'''Note:'''

+

''It has not yet been done, these are just some ideas.''

+

+

Entry points for CE CRT:

+

+

'''Your entrypoint CRT entrypoint'''

+

main mainACRTStartup

+

wmain mainWCRTStartup

+

WinMain WinMainCRTStartup

+

wWinMain wWinMainCRTStartup

+

DllMain _DllMainCRTStartup

+

+

=== Problems with MSVC ===

+

+

If you try to port native code from Linux to Windows CE or even from Windows to Windows CE you will soon run into walls because Microsoft does not provide you with a C-Library that is in following any standards. This is ugly when some parts are missing like errno, fcntl, types, stat, ... but gets even more ugly when there are the headers, but not the library functions.

+

+

=== Compatibility Libraries ===

+

+

The idea is not to port the software to Windows CE/Mobile, but to instead to expand the Windows CE SDK in a way that it supports most of the functions Windows does. Although Windows Mobile SDK's still are a subset af the Windows libraries they came a long way in the last years, and most of the functions that are missing seem to be on a basic level. Maybe it is more of an annoyance then an actual problem.

+

+

=== CELIB ===

+

+

With all the Problems there are with Windows CE C-Libraries it was actually much worse in older Windows CE versions. Rainer Keuchel did a lot of porting back in 2003 ( http://www.rainer-keuchel.de/software.html ) and wrote [http://www.rainer-keuchel.de/wince/celib.html celib] which provides many of the functions Windows CE is lacking. Sadly, this project died and has not been maintained to fit current Windows Versions. But maybe it can help with some ideas for workarounds or to cannibalize some parts.

+

+

=== wcelibcex ===

+

+

Wcelibcex supplements the Windows CE C-library with functions and workarounds for porting applications from Unix and Windows to Windows CE. Originally, the WCELIBCEX development was founded by Taxus SI Ltd. and in 2005 released as an Open Source Software project. The WCELIBCEX project is currently maintained by Mateusz Łoskot. ( http://wcelibcex.sourceforge.net/ )

+

+

At a first glance this project is still active, at least the SVN Version is updated now and then. I've had some success using it but it also is not as complete as one would hope. There are some interesting ideas implemented, like managing the environment through the Windows registry. There would is still a lot to include if we wanted to build without modifying the public libraries but it would give a good starting point.

+

+

=====Installing wcelibcex=====

+

As mentioned the release Version is outdated, so get you should get wcelibcex from svn

This part now really becomes 'read at own risk' at this point I have no idea if this is the best way to build or the easiest way to build or even a slightly sane one. My goal was to come up with a way to compile free software that has been ported for Windows to Windows CE without changing the code but rather by finding workarounds for all the portability issues. I used the before-mentioned wcelibcex to try to get some libraries to run on my Windows Mobile device.

+

For building i used nmake makefiles and no Visual Studio Project files to have more control over the build.

+

+

+

====Setting up the Environment====

+

To Cross-Compile with the MSVC compiler you should write yourself a script to set up your environment, if you don't want to set your system wide variables you'd have to enter really long commands every time you open a new console by hand.

Qt offers a script for most of the INCLUDE, LIB, and PATH variables, called setcepaths, in this example i used it to get the cross-compile paths initialized. Please note the 0x502 Version Numbers are intentional when developing for Windows Mobile 6 we are compiling for Windwos CE 5.2 See: [http://techbase.kde.org/Windows_CE#Windows_CE_.2F_Windows_Mobile Windows CE/Windows Mobile]<br>

+

The # character replaces = for the Windows Environment variables.

+

As you can see I also included wcelibcex since I want to demonstrate how to use the wceex-functions and need it for errno.h.

+

+

CL,_CL_,LINK,_LINK_ are MSVC variables to control cl.exe and link.exe CL is prepend to all options when cl.exe is called,_CL_ is appended, same goes for link.exe and its variables.

+

Note: When using defines cl.exe always uses the last definition it got. So with _CL_ you could override defines from any cl call (e.g. a makefile).

+

+

+

==== Building libiconv ====

+

The last version I have found with msvc Makefiles for iconv was 1.11.1 for a first try to get it working I used that version to have it easier.<br>

The CL defines reroute some function calls. We don't have decent error handling on Windows CE so in my opinion we could just print out error messages or numbers to a console we also don't have (but maybe later find a way to reroute to a file or so) anyways. wceex_abort just terminates the process _strdup is the WinCE equivalent of strdup, MS already provided it. I did not use more configuration Options in config.h because in most cases the workarounds they provide don't help either for Windows CE.

+

NO_NLS=1 stands for building without libintl, since libintl needs iconv to build.

+

====Building gettext-runtime====

+

With gettext I again used a release with msvc makefiles, version 0.14.5 http://ftp.gnu.org/pub/gnu/gettext/gettext-0.14.5.tar.gz <br>

−

=== Additional Notes: ===

+

If you have installed libiconv in the default location you can also use defaults with gettext, otherwise make sure to provide the same prefix you used with libiconv.

−

Currently Windows Mobile >= 6.1 does not load the libgcc_s_sjlj-1.dll libstdc++-6.dll properly, fix is in the works, see:

+

To avoid confusing errors, you may want to edit the makefile to only build the gettext-runtime.

+

Now in the gettext-runtime directory append to the config.h.msvc again:

''loadmsgcat needs close read write fstat open bsearch and raise. Since there were no implementations or workarounds for close read fstat and open in wcelibcex I wrote them myself using fopen fclose. For wceex_raise I took parts from Rainer Keuchel's celib. I'll try to do some decent testing and getting them upstream. But if you have an idea how not to use them please make an edit. ''

+

Now you should be able to build:

+

nmake /f Makefile.msvc DLL=1 MFLAGS=-MD

+

nmake /f Makefile.msvc DLL=1 MFLAGS=-MD install

+

If you get errors make sure that you do not try to build the tools, which are another problem.

+

====Building libiconv with libintl ====

+

Go back to your libiconv directory

+

nmake /f Makefile.msvc DLL=1 MFLAGS=-MD clean

+

nmake /f Makefile.msvc DLL=1 MFLAGS=-MD

+

nmake /f Makefile.msvc DLL=1 MFLAGS=-MD install

+

should run smoothly and link against libintl.

+

If not, make sure that you still have the preprocessor macros defined in CL.

+

==== libxml2 with iconv ====

+

Building libxml2 for WinCE is fairly easy for us, because the official release already was ported to Windows CE, my problem was that I could not convert the EVC project files to my VS installation so I used the Win32 makefile.

+

Checkout libxml2

+

git clone git://git.gnome.org/libxml2

+

Although a port exists it was apparently done some time ago so you have to modify some things, the file include\wsockcompat.h includes winsock.h instead of winsock2.h for _WIN32_WCE. That is no longer needed we have winsock2 on Windows Mobile 6, so change that to winsock2.h<br>

+

Copy the two files wincecompat.h and wincecompat.c from win32\wince into your main src directory in those all the functions needed for compatibility are declared.

+

To avoid conflicts make sure your CL variable is not still set with all the function replacements.

+

Since the original port used EVC-Project files we have to edit the win32\Makefile.msvc to avoid linker errors.

+

In line 69 replace wsock32.lib ws2_32.lib with ws2.lib

+

In line 81 replace kernel32.lib with coredll.lib

+

Add $(XML_INTDIR)\wincecompat.obj to the XML_OBJ list.

+

Now from the win32 subdirectory you should run:

+

cscript configure.js help

+

and configure according to your setup. Make sure to set the inc/lib vars pointing to your iconv installation.

+

nmake /f win32\Makefile libxml libxmla libxmladll

+

should build. Only some utils are still going to make problems.

−

==Packaging:==

+

== Miscellaneous ==

−

Deploying Qt Windows Mobile Applications using LCAB

+

=== Accessing Pocket Outlook ===

+

Similar to the Outlook Object Model for the Desktop Outlook, Microsoft offers the Pocket Outlook Object Model ([http://msdn.microsoft.com/en-us/library/aa914277.aspx POOM]) The related library is called pimstore and part of the Windows Mobile SDK.

+

You can use it to access the pim.vol file which is located in the Windows Mobile root directory. It contains Contacts, Tasks, Calendar entries and the infrared folder. To access messages you have to use the [http://msdn.microsoft.com/en-us/library/bb446118.aspx Messaging API.]

−

LCAB is a free software utility, that has the ability to create Microsoft CAB archives. You can get it on ( http://packages.debian.org/lenny/lcab )or as a Debian package.

+

Establishing a connection is straightforward COM, you have to initialize the COM library find out the COM identifier of PocketOutlook, then create an application class COM server object and logon to the COM server object using the [http://msdn.microsoft.com/en-us/library/aa913088.aspx IPOutlookApp COM interface]

−

Now that you can create cabinet files, the question is how to get Windows Mobile to recognize them as install packages. Thanks to Shaun Jackman this, also is no Problem. He wrote a Perl script to add the needed manifest and setup configuration file. You can find it under ( http://files.intevation.de/incoming/aheinecke/cab_files/pocketpc-cab.pl ) There is also a pocketpc-cab Debian packet out there, which does not support registry entries or the creation of shortcuts.

This installs collidingmice.exe to Program Files/Colliding_Mice , places a shortcut in the Start Menu folder and copies the libraries into the Windows directory. The CE vars are WindowsCE variables, for more on them see the Microsoft documentation.

This page is mostly deprecated it was started for a Project to port Kdepim to Windows CE. All additional patches / cross compile techniques can be found in emerge from the KDE - Windows initative.
Binaries for Windows Mobile 6.5 and a source tarball of Kontact Touch (an optimized variant of KDEPIM software for Touch enabled devices) can be found at:
http://files.kolab.org/local/windows-ce/Kontact-Mobile/testing/latest/

Although Windows CE (officially called Windows Embedded CE) is part of the Windows Embedded family there is a large difference between Windows Embedded CE and other Windows Embedded products. Most importantly Windows CE is not Windows. It has a different Kernel then any other Windows Operating System. And while other embedded products like Windows Embedded Standard or Windows Embedded Enterprise (which are sized down versions of Windows XP) will run Windows applications without problems, Windows CE applications require porting even from Windows.
Windows Mobile then is based on Windows CE (CE has no official meaning) and it's current Versions Windows Mobile 6.1 (and 6.5) are based on Windows CE 5.2 so we will be talking about developing for Windows CE 5.2 when we are talking about developing for Windows Mobile 6.1 or 6.5.
It is confusing but Windows Mobile 6 is not based on Windows CE 6 so it still has the limitations of Windows CE 5. For example the process address space is still limited to 32 MiB and the maximum Number of processes can not exceed 32.

CreateProcess must get both first arguments, name and cmdline. In contrast to Windows NT (and Unix), cmdline must not repeat the name of the executable as argv[0]. Instead, argv[0] is filled in from the module name, and cmdline fills the arguments starting from argv[1].

The only handles that can be duplicated to other processes are Mutexes, Semaphores and Events. These can also simply be opened by their name from different processes for a similar effect. No way to pass File or other handles from one process to another! Must use socketpair (named object by port) or custom device driver (named object by device).

ExitProcess is missing. ExitThread from main thread terminates the whole process!

This should be your first step
Without this tool (or something similar) it is impossible to even kill processes or start programs with command line Arguments. It should be the first thing you install because you need it (or something similar) to install and work with the other Tools.

It is a good working task manager for Windows CE/Mobile it includes: A Process manager, CPU usage, Application Manager, Service Manager, Device Manager, Windows Manager, Notification Manager, IP Config utility, Ping utility, Net Stats utility, Registry Editor, Run program utility.
It allows you to get a detailed look into your System (which process uses which Dlls, what services are started and so on)
Most importantly though, you can use it to kill processes instead of just reseting the device.

There is a existing Port for OpenSSH available at
http://www.codeplex.com/wikipage?projectname=CESSH
The Project self appears to be dead and was originally intended to use as an
extension for the Microsoft Platform builder, which makes installation on
Windows Mobile a bit difficult since there are some hard coded paths included.

There is a CAB-Installer for the CeSSH OpenSSH port available,
download it
here.

Download the CAB-File and install it

For pubkey authentification:

copy your RSA public ID to /authorized_keys

For password authentification:

Taskmgr->Menu->Action->Run the adduser program and specify "username password" in the extra arguments input field

Run either /Programme/OpenSSH/sshd.exe or the Shortcut from your Start Menu/System

For the Pocket PC 2003 platform Microsoft offers a console application, it is
barely usable on Windows Mobile 6.5 but it works good enough to view output or
Debug information. The command line interpreter included in this is not able
to get text input if T9 is disabled, so the best option to call commands appear
to be SSH and the before-mentioned Task Manager.

Copy cmd.exe, console.dll, shell.exe in \windows on device
Set HKEY_LOCAL_MACHINE/Drivers/Console/OutputTo to 0

Note: To let the registry changes take effect you must restart the device

You can modify the registry using the before-mentioned Task Manager.

Warning: Setting Console OutputTo 0 will spawn Console Windows every time
a program writes to stdout or stderr and my heavily impact your performance.
Especially HTC TouchFlow is known to slow down your device heavily when a
console is activated.

There was also another console application for Windows CE but it is
also only for PocketPC 2003 and the company that developed it has vanished
from the internet. It has many problems, you can not use it over SSH for example.
But is just mentioned here because you can use it to enter commands directly
on the device, something that the Microsoft console lacks.
For Download and installation instructions, see:
http://www.walkingrandomly.com/?p=22

It allows you to view and change installed certificates and the general
security configuration on your device, so you can disable them for development.
You have to install it on a Windows machine with Active-Sync connection, though.

http://ceregeditor.mdsoft.pl/ is a good choice when you want to worked for me, although it is not Open Source it is small, clean, free of charge and does the job. It connects with the device and allows you to edit and search the Registry remotely from a Windows Machine.

A small, on device, registry editor is also included in the Task Manager.

First thing you need is Visual Studio professional or standard edition (preferably with service pack 1). Be aware that the express editions are explicitly not supported for Windows CE development. (You could use Microsoft Embedded VC which is cost-free, but deprecated and not supported by Qt) Next thing you need is a Microsoft Windows Mobile Platform SDK corresponding to your target platform. Just search the Microsoft download pages or get the Windows Mobile 6 SDK from here (You should take a loot at the System Requirements)If everything is set up correctly you should now be able to create a “Visual C++ smart device" project in Visual Studio.
Note on Version-Naming: Standard means without touchscreen, Professional means with Touchscreen and Classic means Windows Mobile without mobile phone capabilities

Now you should add your <qt-directory>\bin to your Windows PATH environment variable (which can be done from “Control Panel → System → Advanced →Environment variables”, user and system PATHs are merged by Windows).

Next get up your Visual Studio Command Prompt which should be accessible from the Windows Start Menu. Change the working directory to qt-directory and start the configuration. There should be a configure.exe in your qt-directory with the usual options, (configure.exe -help for more info) for cross compiling you need to give at least the -platform parameter with your host system and -xplatform with your cross-compile target. Supported platforms are listed in the README file. e.g.:

Now that your configuration is set you can start the cross compilation. To switch from your “normal” build environment to the wince target Qt has a nice script included in the /bin directory (which should be in your PATH): just try calling setcepaths and provide your target configuration.

setcepaths wincewm65professional-msvc2008

(if this complains that it cannot find checksdk.exe, you are building out-of-source (shadow builds in Qt lingo) and you need to add <builddir>\bin to PATH, too, then re-run the script).
With nmake (Visual Studio version of make) you can now build Qt for your target system.

CeGCC (http://cegcc.sourceforge.net/) is a free cross-development environment for ARM-based systems running Windows CE. It is not officially supported by Qt and work with it is highly experimental, but given some work it could be possible to use it to build KDE-applications for Windows Mobile.

After downloading you should take a look at the cegcc_configure script, maybe change the installation prefix there and then execute it. If your configuration fails make sure that your environment is not yet set for cross-compiling.

When configuration is complete you can build the host-tools, just go into your checkout and execute: {

With the creation of cabinet archives as a prerequisite, the question is how to get Windows Mobile to recognize them as install packages. Its basically a way in which the files have to be ordered and named inside the archive combined with a setup.xml file with installation instructions. There is a Perl script to add the needed manifest and setup configuration file. You can find it under ( http://files.intevation.de/incoming/aheinecke/cab_files/pocketpc-cab.pl )

This script needs a configuration file (two if you want to install registry keys, also), but it is much more simple and straightforward then the Cabwiz variant. Simply write down for every file you want to package a line a file:

Maybe in some situations Cabwiz has its relevance, (e.g. you only want to build from windows) but even then i would suggest to directly edit the setup.xml that is included in the Cabinet file to suit your needs.
Before i found lcab i wrote a guide on how to Package a simple Qt-Application with cabwiz

If you try to port native code from Linux to Windows CE or even from Windows to Windows CE you will soon run into walls because Microsoft does not provide you with a C-Library that is in following any standards. This is ugly when some parts are missing like errno, fcntl, types, stat, ... but gets even more ugly when there are the headers, but not the library functions.

The idea is not to port the software to Windows CE/Mobile, but to instead to expand the Windows CE SDK in a way that it supports most of the functions Windows does. Although Windows Mobile SDK's still are a subset af the Windows libraries they came a long way in the last years, and most of the functions that are missing seem to be on a basic level. Maybe it is more of an annoyance then an actual problem.

With all the Problems there are with Windows CE C-Libraries it was actually much worse in older Windows CE versions. Rainer Keuchel did a lot of porting back in 2003 ( http://www.rainer-keuchel.de/software.html ) and wrote celib which provides many of the functions Windows CE is lacking. Sadly, this project died and has not been maintained to fit current Windows Versions. But maybe it can help with some ideas for workarounds or to cannibalize some parts.

Wcelibcex supplements the Windows CE C-library with functions and workarounds for porting applications from Unix and Windows to Windows CE. Originally, the WCELIBCEX development was founded by Taxus SI Ltd. and in 2005 released as an Open Source Software project. The WCELIBCEX project is currently maintained by Mateusz Łoskot. ( http://wcelibcex.sourceforge.net/ )

At a first glance this project is still active, at least the SVN Version is updated now and then. I've had some success using it but it also is not as complete as one would hope. There are some interesting ideas implemented, like managing the environment through the Windows registry. There would is still a lot to include if we wanted to build without modifying the public libraries but it would give a good starting point.

This part now really becomes 'read at own risk' at this point I have no idea if this is the best way to build or the easiest way to build or even a slightly sane one. My goal was to come up with a way to compile free software that has been ported for Windows to Windows CE without changing the code but rather by finding workarounds for all the portability issues. I used the before-mentioned wcelibcex to try to get some libraries to run on my Windows Mobile device.
For building i used nmake makefiles and no Visual Studio Project files to have more control over the build.

To Cross-Compile with the MSVC compiler you should write yourself a script to set up your environment, if you don't want to set your system wide variables you'd have to enter really long commands every time you open a new console by hand.
It could be looking like this (in a standard installation):

Qt offers a script for most of the INCLUDE, LIB, and PATH variables, called setcepaths, in this example i used it to get the cross-compile paths initialized. Please note the 0x502 Version Numbers are intentional when developing for Windows Mobile 6 we are compiling for Windwos CE 5.2 See: Windows CE/Windows Mobile
The # character replaces = for the Windows Environment variables.
As you can see I also included wcelibcex since I want to demonstrate how to use the wceex-functions and need it for errno.h.

CL,_CL_,LINK,_LINK_ are MSVC variables to control cl.exe and link.exe CL is prepend to all options when cl.exe is called,_CL_ is appended, same goes for link.exe and its variables.
Note: When using defines cl.exe always uses the last definition it got. So with _CL_ you could override defines from any cl call (e.g. a makefile).

Explanation:
The CL defines reroute some function calls. We don't have decent error handling on Windows CE so in my opinion we could just print out error messages or numbers to a console we also don't have (but maybe later find a way to reroute to a file or so) anyways. wceex_abort just terminates the process _strdup is the WinCE equivalent of strdup, MS already provided it. I did not use more configuration Options in config.h because in most cases the workarounds they provide don't help either for Windows CE.
NO_NLS=1 stands for building without libintl, since libintl needs iconv to build.

If you have installed libiconv in the default location you can also use defaults with gettext, otherwise make sure to provide the same prefix you used with libiconv.
To avoid confusing errors, you may want to edit the makefile to only build the gettext-runtime.
Now in the gettext-runtime directory append to the config.h.msvc again:

loadmsgcat needs close read write fstat open bsearch and raise. Since there were no implementations or workarounds for close read fstat and open in wcelibcex I wrote them myself using fopen fclose. For wceex_raise I took parts from Rainer Keuchel's celib. I'll try to do some decent testing and getting them upstream. But if you have an idea how not to use them please make an edit.

Building libxml2 for WinCE is fairly easy for us, because the official release already was ported to Windows CE, my problem was that I could not convert the EVC project files to my VS installation so I used the Win32 makefile.
Checkout libxml2

Although a port exists it was apparently done some time ago so you have to modify some things, the file include\wsockcompat.h includes winsock.h instead of winsock2.h for _WIN32_WCE. That is no longer needed we have winsock2 on Windows Mobile 6, so change that to winsock2.h
Copy the two files wincecompat.h and wincecompat.c from win32\wince into your main src directory in those all the functions needed for compatibility are declared.
To avoid conflicts make sure your CL variable is not still set with all the function replacements.
Since the original port used EVC-Project files we have to edit the win32\Makefile.msvc to avoid linker errors.

In line 69 replace wsock32.lib ws2_32.lib with ws2.lib
In line 81 replace kernel32.lib with coredll.lib
Add $(XML_INTDIR)\wincecompat.obj to the XML_OBJ list.

Now from the win32 subdirectory you should run:

cscript configure.js help

and configure according to your setup. Make sure to set the inc/lib vars pointing to your iconv installation.

Similar to the Outlook Object Model for the Desktop Outlook, Microsoft offers the Pocket Outlook Object Model (POOM) The related library is called pimstore and part of the Windows Mobile SDK.
You can use it to access the pim.vol file which is located in the Windows Mobile root directory. It contains Contacts, Tasks, Calendar entries and the infrared folder. To access messages you have to use the Messaging API.

Establishing a connection is straightforward COM, you have to initialize the COM library find out the COM identifier of PocketOutlook, then create an application class COM server object and logon to the COM server object using the IPOutlookApp COM interface

After you have established the connection you can use the IPOutlook interface methods to retrieve or manipulate the data.
I have written a small program that exports all the Contact data on a device into a CSV file. POutlookExport.zip