Difference between revisions of "Windows CE Interface"

From Free Pascal wiki
Jump to navigationJump to search
m (Fix template spelling mistake)
(fixed some typo's + some rephrasing (this page should really be checked by a native English speaker).)
Line 3: Line 3:
  
 
== Introduction ==
 
== Introduction ==
The Windows CE Interface was started by [[user:Sekelsenmat|Felipe Monteiro de Carvalho]] and latter extended by Roozbeh and other contributors. The interface was started on 2006 with a still under development Windows CE FPC compiler. A stable compiler was released on 2007, which made it possible to release a WinCE add-on installer together with the 0.9.24 Lazarus release.
+
The Windows CE Interface was started by [[user:Sekelsenmat|Felipe Monteiro de Carvalho]] and latter extended by Roozbeh and other contributors. Development of the interface was started in 2006, when the Windows CE FPC compiler was still under development. In 2007 a stable compiler was released, which made it possible to release a WinCE add-on installer for the Lazarus 0.9.24 release.
  
Because of the bad experience with code sharing between similar interfaces in the past with the gtk/gtk2 interface, it was decided to start a clean code for WinCE. Because the APIs are very similar, a lot of the code on the WinCE interface is copyed from the Win32/64 Interface.
+
Because of the bad experience with code sharing between similar interfaces in the past with the gtk/gtk2 interface, it was decided to start a clean code for WinCE. Because the APIs are very similar, a lot of the code of the WinCE interface is copied from the Win32/64 Interface.
  
 
{{Other Interfaces}}
 
{{Other Interfaces}}
Line 11: Line 11:
 
== Setting Up the Windows CE interface ==
 
== Setting Up the Windows CE interface ==
  
To set up the Windows CE interface you will need to either use the add-on installer or set up the interface manually. Both options are detailed below. Using the add-on installer is, of course, much easier.
+
To set up the Windows CE interface you will need to either use the add-on installer or set up the interface manually. Both options are described below in detail. Using the add-on installer is, of course, much easier.
  
 
=== Using the stable add-on installer (Recommended Method)===
 
=== Using the stable add-on installer (Recommended Method)===
Line 40: Line 40:
 
* Download and install the add-on installer for the same Free Pascal version you just downloaded. It's on the same page.
 
* Download and install the add-on installer for the same Free Pascal version you just downloaded. It's on the same page.
  
* The rest of the steps is similar to the step-by-step guide on using the stable add-on installer
+
* The rest of the steps are similar to the step-by-step guide using the stable add-on installer.
  
 
=== Setting up the Windows CE interface manually ===
 
=== Setting up the Windows CE interface manually ===
  
To see which FPC version can be used with each Lazarus version please check [[LCL_Internals#Minimum_Toolkit_versions]].
+
To verify which FPC-version can be used with each Lazarus version please check [[LCL_Internals#Minimum_Toolkit_versions]].
  
 
Here are instruction to set up the Windows CE interface manually:
 
Here are instruction to set up the Windows CE interface manually:
  
'''Step 1''' - To start with you will need to recompile the compiler on Windows to create a Windows CE - ARM Crosscompiler. There are instructions here: [[WinCE port]].
+
'''Step 1''' - To start with you will need to recompile the compiler on Windows to create a Windows CE - ARM Cross-compiler. There are instructions here: [[WinCE port]].
  
 
* Use TortoiseSVN to checkout the latest 2.2.5: http://svn.freepascal.org/svn/fpc/branches/fixes_2_2/
 
* Use TortoiseSVN to checkout the latest 2.2.5: http://svn.freepascal.org/svn/fpc/branches/fixes_2_2/
Line 62: Line 62:
 
</pre>
 
</pre>
  
'''Step 2''' - You also need to compile FCL (Free Component Library) with the newly built compile. Instructions [[WinCE port#Building_FPC_libraries|here]].
+
'''Step 2''' - You also need to compile the FCL (Free Component Library) with the newly built compiler. Instructions [[WinCE port#Building_FPC_libraries|here]].
  
* This clever batch script makes this easier (don't forget to fix the paths to your machine). OPT="-FU... will put all compiled units on the same place, which is very convenient, (but can cause [http://bugs.freepascal.org/view.php?id=11347 problems]. It is better to use a make clean all install instead):
+
* The following clever batch script makes this easier (don't forget to fix the paths to match those on your machine). OPT="-FU... will put all compiled units on the same place, which is very convenient, (but can cause [http://bugs.freepascal.org/view.php?id=11347 problems]. It is better to use a make clean all install instead):
  
 
<pre>
 
<pre>
Line 84: Line 84:
 
This should compile LCL for Windows CE.
 
This should compile LCL for Windows CE.
  
'''Step 4''' - Cross-compile the LazarusPackageIntf so you can use 3rd party visual components. Go to lazarus\packager\registration and do:
+
'''Step 4''' - Cross-compile the LazarusPackageIntf in order to be able to use 3rd party visual components. Go to lazarus\packager\registration and do:
  
 
<pre>
 
<pre>
Line 94: Line 94:
 
NOTE: you need to specify $(LazarusDir)\packager\units\$(TargetCPU)-$(TargetOS)\ into your project's unit path (adding FCL as requirement should do that).
 
NOTE: you need to specify $(LazarusDir)\packager\units\$(TargetCPU)-$(TargetOS)\ into your project's unit path (adding FCL as requirement should do that).
  
'''Step 5''' - Now you can use Lazarus IDE to design,compile and debug your applications.
+
'''Step 5''' - Now you can use the Lazarus IDE to design, compile and debug your applications.
  
* You can also use scripts similar to this for compiling your applications:
+
* You can also use scripts similar to the one below for compiling your applications:
  
 
<pre>
 
<pre>
Line 114: Line 114:
 
If you compiled your own compiler or installed it without using the Lazarus add-on installer, you also need to change '''compiler path''' in '''Environment options''' to point to your ppcrossarm.exe compiler. In other cases the compiler should already be set to the correct one, which is fpc.exe, which is a front end which chooses the correct back end compiler for the target CPU. In this case the path will be similar to C:\lazarus\fpc\2.2.2\bin\i386-win32\fpc.exe varying with the version of your installed FPC.
 
If you compiled your own compiler or installed it without using the Lazarus add-on installer, you also need to change '''compiler path''' in '''Environment options''' to point to your ppcrossarm.exe compiler. In other cases the compiler should already be set to the correct one, which is fpc.exe, which is a front end which chooses the correct back end compiler for the target CPU. In this case the path will be similar to C:\lazarus\fpc\2.2.2\bin\i386-win32\fpc.exe varying with the version of your installed FPC.
  
Now IDE is ready to compiler your files.
+
Now, the IDE is ready to compile your files.
  
 
=== Debugging Windows CE software on the Lazarus IDE ===
 
=== Debugging Windows CE software on the Lazarus IDE ===
Line 127: Line 127:
  
  
'''Step 2''' - If you are using Microsoft Device Emulator Preview, launch(or restore)it.Make sure you've started emulator with 128MB of RAM.Select a path for shared folders in emulator, add copy command to your .bat file used for building your application to copy the compiled exe file to your shared path.(as you can see in my .bat file).Here is a .bat file you can use to launch emulator with 128 of ram.
+
'''Step 2''' - If you are using Microsoft Device Emulator Preview, launch(or restore)it. Make sure you've started emulator with 128MB of RAM. Select a path for shared folders in emulator, add copy command to your .bat file used for building your application to copy the compiled exe file to your shared path. (as you can see in my .bat file). Here is a .bat file you can use to launch the emulator with 128 of ram.
  
 
<pre>
 
<pre>
Line 134: Line 134:
 
</pre>
 
</pre>
  
After that just do 'save and exit' whenever you want to quit emulator,and launch it again from shortcuts created in your start menu.(the shortcuts with '(restore)').
+
After that, just do 'save and exit' whenever you want to quit emulator and, launch it again from shortcuts created in your start menu. (The shortcuts with '(restore)').
  
'''Step 3''' - Run Device Emulator Manager and in available emulators right click on the name of emulator and do cradle.Now Microsoft ActiveSync will be launched.If not in Micrososft ActiveSync Go to the menu '''File->Get connected'''.If still ActiveSync doesn't recognize the emulator.Uncradle and Cradle the emulator again.
+
'''Step 3''' - Run Device Emulator Manager and in available emulators right click on the name of emulator and do cradle. Now Microsoft ActiveSync will be launched. If not in Microsoft ActiveSync, Go to the menu '''File->Get connected'''. If ActiveSync still doesn't recognize the emulator, Uncradle and Cradle the emulator again.
  
 
'''Step 4 - Optional''' - This step is optional and if you don't do it, gdb will do this for you, but it might take some 5 minutes to do it. Copy your executable file with File Explorer program in your emulator to the directory "\gdb". If there is no gdb directory in the root folder, create it.
 
'''Step 4 - Optional''' - This step is optional and if you don't do it, gdb will do this for you, but it might take some 5 minutes to do it. Copy your executable file with File Explorer program in your emulator to the directory "\gdb". If there is no gdb directory in the root folder, create it.
  
 
'''Step 5''' - Now you can safely debug your application.gdb for wince will be launched.it will copy arm-wince-pe-stub.exe to \gdb folder and check if your application.exe file is there and will launch the program.
 
'''Step 5''' - Now you can safely debug your application.gdb for wince will be launched.it will copy arm-wince-pe-stub.exe to \gdb folder and check if your application.exe file is there and will launch the program.
If you encountered an error make sure the \gdb folder is created,arm-wince-pe-stub.exe and you exe file is there.Also most of the times because of big size of exe file you can not copy that into your \gdb file.So you have to call Microsoft Device Emulator Preview with 128mg of ram instead of default 64mg ram.
+
If you encountered an error a) make sure the \gdb folder is created and b) that both arm-wince-pe-stub.exe and your .exe file are present. Also most of the times because of big size of a .exe file, you can not copy that into your \gdb file. So, you'll have to call Microsoft Device Emulator Preview with 128mg ram instead of the default 64mg ram.
  
 
'''Known bugs'''
 
'''Known bugs'''
  
There are some known issues with debugging and some work around to them. Please read the bug tracker: [http://bugs.freepascal.org/view.php?id=21061] and [http://bugs.freepascal.org/view.php?id=24126]
+
There are some known issues with debugging, for which some have a work-around. Please read the bug tracker: [http://bugs.freepascal.org/view.php?id=21061] and [http://bugs.freepascal.org/view.php?id=24126]
  
 
'''Some Hints'''
 
'''Some Hints'''
Line 153: Line 153:
 
--eval-command="set remotedirectory \Storage Card\Program Files\My Program\bin"
 
--eval-command="set remotedirectory \Storage Card\Program Files\My Program\bin"
 
</pre>
 
</pre>
#You can reduce the size of exe file by check "Use external gdb file debug symbols file -Xg", and "Strip Symbols -Xs", the file myapp.gdb generated and stay at your computer to use it with the gdb.
+
#You can reduce the size of .exe file by checking "Use external gdb file debug symbols file -Xg", and "Strip Symbols -Xs", the file myapp.gdb will be generated which can then be used with gdb.
  
 
=== Installing and Using the Pocket PC Emulator ===
 
=== Installing and Using the Pocket PC Emulator ===
Line 175: Line 175:
 
2 - Download and install the [http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=20686a1d-97a8-4f80-bc6a-ae010e085a6e Windows Mobile 6.5 Developer Tool Kit (with localized Images)]
 
2 - Download and install the [http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=20686a1d-97a8-4f80-bc6a-ae010e085a6e Windows Mobile 6.5 Developer Tool Kit (with localized Images)]
  
3 - There is no more ActiveSync in Vista or superior, now it is called "Windows Mobile Device Center. So download and install it (this download requires the Genuine windows check):
+
3 - There is no more ActiveSync in Vista or newer. For newer Windows version it is named "Windows Mobile Device Center. So, download and install it (this download requires the Genuine Windows check):
  
3.1 - For Windows Vista or Superior 32-bits: http://www.microsoft.com/en-us/download/details.aspx?id=14
+
3.1 - For Windows Vista or higher (32-bits): http://www.microsoft.com/en-us/download/details.aspx?id=14
  
3.2 - For Windows Vista or Superior 64-bits: http://www.microsoft.com/en-us/download/details.aspx?id=3182
+
3.2 - For Windows Vista or higher (64-bits): http://www.microsoft.com/en-us/download/details.aspx?id=3182
  
  
Line 190: Line 190:
 
1 - Start the Emulator
 
1 - Start the Emulator
  
2 - Start the Device Emulator Manager. Previously it had a nice start menu icon, but in Vista+ it is well hidden. You have to run the file dvcemumanager.exe which is probably located in C:\Program Files\Microsoft Device Emulator\1.0
+
2 - Start the Device Emulator Manager. Previously it had a nice start menu icon, but in Vista+ it is well hidden. You have to run the file dvcemumanager.exe, which is probably located in C:\Program Files\Microsoft Device Emulator\1.0
  
 
[[File:device_manager.gif]]
 
[[File:device_manager.gif]]
Line 203: Line 203:
 
[[File:mobile_center_dma.gif]]
 
[[File:mobile_center_dma.gif]]
  
Now it should connect after closing the dialog.
+
After closing the dialog it should then connect.
  
 
=====Setting up a shared folder in the emulator=====
 
=====Setting up a shared folder in the emulator=====
  
The shared folder is a folder in your computer which is mounted in the device with the path "\Storage Card\" and it works in the device as if it was a memory card. To set this up, click in File -> Configure in the emulator and set the path to the folder, as shown in the screenshot below:
+
The shared folder is a folder in your computer which is mounted in the device with the path "\Storage Card\" and it works in the device as if it was a memory card. To set this up, click in File -> Configure in the emulator and set the path to the folder, as shown in the screen shot below:
  
 
[[File:wince_emulator_shared_folder.png]]
 
[[File:wince_emulator_shared_folder.png]]
Line 233: Line 233:
 
2 - If you never configured your shared folder for the emulator, do so now, by clicking on the menu File --> Configure once the emulator opens. Set it to a folder where you can access your Windows CE executable created with Lazarus.
 
2 - If you never configured your shared folder for the emulator, do so now, by clicking on the menu File --> Configure once the emulator opens. Set it to a folder where you can access your Windows CE executable created with Lazarus.
  
3 - On the emulator click: Start --> Programs. Now select "File Explorer". Now select "Storage Card". Navigate until you find your executable and double click it to execute it.
+
3 - On the emulator click: Start --> Programs. Now select "File Explorer". Then select "Storage Card". Navigate until you find your executable and double click it to execute it.
  
 
== How to add a new control ==
 
== How to add a new control ==
Line 252: Line 252:
 
   end;
 
   end;
  
Every WS class, that actually implements something must be registered. See the initialization section at the end of the wincewsXXX.pp unit:
+
Every WS class, that actually implements something, must be registered. See the initialization section at the end of the wincewsXXX.pp unit:
 
   RegisterWSComponent(TButton, TWinCEWSButton);
 
   RegisterWSComponent(TButton, TWinCEWSButton);
  

Revision as of 07:54, 1 July 2015

Windows logo - 2012.svg

This article applies to Windows only.

See also: Multiplatform Programming Guide

WinCE Logo.png

This article applies to Windows CE only.

See also: Multiplatform Programming Guide

English (en) français (fr) 한국어 (ko) português (pt) 中文(台灣)‎ (zh_TW)

Introduction

The Windows CE Interface was started by Felipe Monteiro de Carvalho and latter extended by Roozbeh and other contributors. Development of the interface was started in 2006, when the Windows CE FPC compiler was still under development. In 2007 a stable compiler was released, which made it possible to release a WinCE add-on installer for the Lazarus 0.9.24 release.

Because of the bad experience with code sharing between similar interfaces in the past with the gtk/gtk2 interface, it was decided to start a clean code for WinCE. Because the APIs are very similar, a lot of the code of the WinCE interface is copied from the Win32/64 Interface.

Other Interfaces

Platform specific Tips

Interface Development Articles

Setting Up the Windows CE interface

To set up the Windows CE interface you will need to either use the add-on installer or set up the interface manually. Both options are described below in detail. Using the add-on installer is, of course, much easier.

Using the stable add-on installer (Recommended Method)

With the first stable release of Free Pascal for Windows CE the installation of a WinCE development environment was never easier. The step-by-step guide below is all you need to install and configure Lazarus to compile wince applications.

Step-by-step guide:

  • Download and install the add-on installer (cross-arm-wince) for the same Lazarus version you just downloaded. It's on the same Source Forge Download page.
  • You can now compile arm-wince application from within Lazarus by changing in the compiler options:
    • Project -> Project Options -> Compiler Options -> Paths -> LCL Widget Type: wince or maybe Project -> Project Options -> Compiler Options -> Paths -> Select another widget set (Macro LCLWidgetType) --> Add --> Set LCLWidgetType --> Value "wince"
    • Project -> Project Options -> Compiler Options -> Config and Target -> Target OS: wince
    • Project -> Project Options -> Compiler Options -> Config and Target -> Target CPU Family: arm
  • To reduce build filesize, in the Project -> Project Options -> Compiler Options -> Debugging section, check Strip symbols from executable (-Xs) and uncheck all the rest.

Using the snapshot add-on installer

Instead of using the stable release, it's also possible to use the latest development version of the Windows CE interface through the daily snapshot. It's untested, but may be helpful if you need fixes which were added after the latest stable release and consider building everything yourself too hard or too much work.

Step-by-step guide:

  • Install the latest Lazarus snapshot on Windows normally from here. Make sure you choose a Win32 snapshot with the exact same FPC version as the WinCE snapshot: http://www.hu.freepascal.org/lazarus/
  • Download and install the add-on installer for the same Free Pascal version you just downloaded. It's on the same page.
  • The rest of the steps are similar to the step-by-step guide using the stable add-on installer.

Setting up the Windows CE interface manually

To verify which FPC-version can be used with each Lazarus version please check LCL_Internals#Minimum_Toolkit_versions.

Here are instruction to set up the Windows CE interface manually:

Step 1 - To start with you will need to recompile the compiler on Windows to create a Windows CE - ARM Cross-compiler. There are instructions here: WinCE port.

  • Then create a batch script like this one to build your compiler starting from your installed FPC 2.2.4 (either from Lazarus or from separate install):
cd compiler
PATH=C:\Programas\lazarus220\fpc\2.2.4\bin\i386-win32
make cycle CPU_TARGET=arm OS_TARGET=wince
cd ..
pause

Step 2 - You also need to compile the FCL (Free Component Library) with the newly built compiler. Instructions here.

  • The following clever batch script makes this easier (don't forget to fix the paths to match those on your machine). OPT="-FU... will put all compiled units on the same place, which is very convenient, (but can cause problems. It is better to use a make clean all install instead):
cd packages
PATH=C:\Programas\lazarus220\fpc\2.2.5\bin\i386-win32
make clean all CPU_TARGET=arm OS_TARGET=wince PP=ppcrossarm.exe OPT="-FUC:\Programas\lazarus220\fpc\2.2.5\units\arm-wince"
cd ..
pause

Step 3 - Put the batch file below on the root of your subversion Lazarus directory and run it

PATH=C:\Programas\lazarus22\fpc\2.2.5\bin\i386-win32;c:\Programas\arm
make lcl LCL_PLATFORM=wince PP=ppcrossarm.exe CPU_TARGET=arm OS_TARGET=wince
pause

This should compile LCL for Windows CE.

Step 4 - Cross-compile the LazarusPackageIntf in order to be able to use 3rd party visual components. Go to lazarus\packager\registration and do:

PATH=C:\Programas\lazarus22\fpc\2.2.5\bin\i386-win32;c:\Programas\arm
make PP=ppcrossarm.exe CPU_TARGET=arm OS_TARGET=wince
pause

NOTE: you need to specify $(LazarusDir)\packager\units\$(TargetCPU)-$(TargetOS)\ into your project's unit path (adding FCL as requirement should do that).

Step 5 - Now you can use the Lazarus IDE to design, compile and debug your applications.

  • You can also use scripts similar to the one below for compiling your applications:
PATH=C:\Programas\lazarus22\fpc\2.2.5\bin\i386-win32;c:\Programas\arm
ppcrossarm.exe -Twince -FuC:\Programas\fpc\rtl\units\arm-wince -FDC:\Programas\arm -XParm-wince- test.pas
ppcrossarm.exe -Twince -FuC:\programas\lazarus\lcl\units\arm-wince -FuC:\programas\lazarus\lcl\units\arm-wince\wince -FuC:\Programas\fpc\rtl\units\arm-wince -FDC:\Programas\arm -XParm-wince- windowtest.pas
pause

Compiling Windows CE project files with Lazarus IDE

NOTE: recently a "wincemenures.or" file is reported missing on linking. You just need to copy this file from "lazarus/lcl/interfaces/wince" to "lazarus/lcl/units/arm-wince" and everything will be fine.

Everything is just as you do with other interfaces and OSes. Make sure you have selected wince as widgetset in in Compiler Options->Paths and in Code tab page select WinCE as target os and arm as Target CPU.

If you compiled your own compiler or installed it without using the Lazarus add-on installer, you also need to change compiler path in Environment options to point to your ppcrossarm.exe compiler. In other cases the compiler should already be set to the correct one, which is fpc.exe, which is a front end which chooses the correct back end compiler for the target CPU. In this case the path will be similar to C:\lazarus\fpc\2.2.2\bin\i386-win32\fpc.exe varying with the version of your installed FPC.

Now, the IDE is ready to compile your files.

Debugging Windows CE software on the Lazarus IDE

You can also debug applications created within Lazarus IDE.

Step 1 - In Lazarus IDE go to the menu Environment->Debugger Options. Change the debugger path to the directory with gdb for wince.you can get it from here ftp://ftp.freepascal.org/pub/fpc/contrib/cross/gdb-6.4-win32-arm-wince.zip

Also read the notes on http://bugs.freepascal.org/view.php?id=21061 for information on additional setup.

And you also need to have ActiveSync installed for gdb to work. You can get ActiveSync here: http://www.microsoft.com/windowsmobile/en-us/help/synchronize/activesync45.mspx


Step 2 - If you are using Microsoft Device Emulator Preview, launch(or restore)it. Make sure you've started emulator with 128MB of RAM. Select a path for shared folders in emulator, add copy command to your .bat file used for building your application to copy the compiled exe file to your shared path. (as you can see in my .bat file). Here is a .bat file you can use to launch the emulator with 128 of ram.

start deviceemulator.exe ".\ppc_2003_se\PPC_2003_SE_WWE_ARMv4.bin" /memsize 128 /skin 
".\ppc_2003_se\PocketPC_2003_Skin.xml"

After that, just do 'save and exit' whenever you want to quit emulator and, launch it again from shortcuts created in your start menu. (The shortcuts with '(restore)').

Step 3 - Run Device Emulator Manager and in available emulators right click on the name of emulator and do cradle. Now Microsoft ActiveSync will be launched. If not in Microsoft ActiveSync, Go to the menu File->Get connected. If ActiveSync still doesn't recognize the emulator, Uncradle and Cradle the emulator again.

Step 4 - Optional - This step is optional and if you don't do it, gdb will do this for you, but it might take some 5 minutes to do it. Copy your executable file with File Explorer program in your emulator to the directory "\gdb". If there is no gdb directory in the root folder, create it.

Step 5 - Now you can safely debug your application.gdb for wince will be launched.it will copy arm-wince-pe-stub.exe to \gdb folder and check if your application.exe file is there and will launch the program. If you encountered an error a) make sure the \gdb folder is created and b) that both arm-wince-pe-stub.exe and your .exe file are present. Also most of the times because of big size of a .exe file, you can not copy that into your \gdb file. So, you'll have to call Microsoft Device Emulator Preview with 128mg ram instead of the default 64mg ram.

Known bugs

There are some known issues with debugging, for which some have a work-around. Please read the bug tracker: [1] and [2]

Some Hints

  1. You can change the remote directory from /gdb to yours by add gdb parameter --eval-command="set remotedirectory ...
--eval-command="set remotedirectory \Storage Card\Program Files\My Program\bin"
  1. You can reduce the size of .exe file by checking "Use external gdb file debug symbols file -Xg", and "Strip Symbols -Xs", the file myapp.gdb will be generated which can then be used with gdb.

Installing and Using the Pocket PC Emulator

Windows Mobile 5.0 Emulator

1 - You can download a Pocket PC Emulator from Microsoft here. First, download and install the file V1Emulator.zip.

2 - Next, be careful that there is a wrong information on the website. It will say that you need to install the Virtual Machine Network Driver, but the link provided on the website is broken. Instead, download Virtual PC 2007 here. This will install the necessary driver too.

3 - Now, go back to the first website and download and install the efp.msi file

Now you should have a fully functional PocketPC Emulator which can be utilized together with Lazarus to develop applications.

To run a Lazarus application on the emulator you can either use GDB via ActiveSync, or you can also just execute it directly.

Windows Mobile 6.5 in Windows Vista or superior

1 - Download and install the Microsoft Device Emulator 3.0

2 - Download and install the Windows Mobile 6.5 Developer Tool Kit (with localized Images)

3 - There is no more ActiveSync in Vista or newer. For newer Windows version it is named "Windows Mobile Device Center. So, download and install it (this download requires the Genuine Windows check):

3.1 - For Windows Vista or higher (32-bits): http://www.microsoft.com/en-us/download/details.aspx?id=14

3.2 - For Windows Vista or higher (64-bits): http://www.microsoft.com/en-us/download/details.aspx?id=3182


For information about cradling and connecting to a network, read: [3]

Connecting the Windows Mobile 6.5 emulator in Vista or Superior to the computer

To connect the emulator to the computer, follow these steps:

1 - Start the Emulator

2 - Start the Device Emulator Manager. Previously it had a nice start menu icon, but in Vista+ it is well hidden. You have to run the file dvcemumanager.exe, which is probably located in C:\Program Files\Microsoft Device Emulator\1.0

device manager.gif

3 - You will see the devices GUID > Right click it and select "Cradle".

cradle.gif

4 - Run the "Windows Mobile Device Center". It should have a start menu icon by now. When it opens, select "Mobile Device Settings" and change the "Allow connections to one of the following" from "Bluetooth" to "DMA"

mobile center dma.gif

After closing the dialog it should then connect.

Setting up a shared folder in the emulator

The shared folder is a folder in your computer which is mounted in the device with the path "\Storage Card\" and it works in the device as if it was a memory card. To set this up, click in File -> Configure in the emulator and set the path to the folder, as shown in the screen shot below:

wince emulator shared folder.png

Links to Emulators and Images

Emulators

Microsoft Device Emulator 2.0

Microsoft Device Emulator 3.0

Images

Windows Mobile 6.0 Localized Emulator Images

Windows Mobile 6.1 Emulator Images (USA only)

Windows Mobile 6.1.4 Emulator Images (USA only)

Windows Mobile 6.5 Developer Tool Kit (with localized Images)

Running an application on the emulator

1 - Go the the Windows Programs Menu --> "Windows Mobile Emulator Images" --> "PocketPC"

2 - If you never configured your shared folder for the emulator, do so now, by clicking on the menu File --> Configure once the emulator opens. Set it to a folder where you can access your Windows CE executable created with Lazarus.

3 - On the emulator click: Start --> Programs. Now select "File Explorer". Then select "Storage Card". Navigate until you find your executable and double click it to execute it.

How to add a new control

For example TButton.

TButton is defined in lcl/buttons.pp. This is the platform independent part of the LCL, which is used by the normal LCL programmer.

Its widgetset class is in lcl/widgetset/wsbuttons.pp. This is the platform independent base for all widgetsets (qt, carbon, gtk, win32, ...).

It's wince interface class is in lcl/interfaces/wince/wincewsbuttons.pp:

 TWinCEWSButton = class(TWSButton)
 private
 protected
 public
   class function  CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
 end;

Every WS class, that actually implements something, must be registered. See the initialization section at the end of the wincewsXXX.pp unit:

 RegisterWSComponent(TButton, TWinCEWSButton);


Also notice that DestroyHandle should be implemented to clean up memory utilized by the control.

Gallery

Below are screenshots of applications created with Lazarus for Windows CE:


Virtual Moon Atlas - A free software for Moon observation or survay ( http://ap-i.net/avl/en/start ):

Vmap1 west east.jpg


LazCalendar - A simple calendar application:

Calendar Wince App.png


germesorders - A simple database application using sqlite and RxLib

germes2.png


ZzOo, pronounced /'zi:zu:/, is a free Western Zodiac sign finder. You can install it directly and free of charge on your mobile phone by visiting the GetJar app store.

zzoo-wince.png


Mini SQLite Viewer - Simple SQlite viewer/manager for WinCE and Win32

MiniSQLiteViewerApp.png


STAR Manager - advanced system manager that allows to adjust backligth and sound volume of ARM processor-based WinCE device, set desktop wallpapers, controll and manage system pocesses and memory load, contol battery charge and see device configuration.

Progr-starmgr-1.jpg


Wireless Orders for Mini Bar Cafe

Win32 TCP/IP Application Server, Win32 TCP/IP Client, WinCE TCP/IP Client. Using Lazarus and lNet we develop wireless ordering system for Mini Bar - Cafe. Print receipts directly to Cash Mashine.

More Info ( http://www.cforce.gr/orders.htm ) Demo ( http://www.cforce.gr/downloads/setupwodemo.exe )

order.jpg Example.jpg table.jpg mtrl.jpg

See Also