Valid windows ce applications

Содержание
  1. WinCE Programming Tips
  2. Contents
  3. TIPS / FAQ
  4. The error message: SomeProject is not a valid Windows CE application
  5. Application runs on Windows Device Emulator, but not on physical device
  6. Missing aygshell.dll
  7. Wrong architecture
  8. Missing functions due to Operating System version
  9. Get Device ID
  10. Get Device Name
  11. Show/Hide SIP Panel
  12. Wakeup Device/ Power On
  13. LED / Vibrator
  14. Getting Battery Status
  15. Prevent Phone from Entering in Standby Mode
  16. Installation of an app build with Lazarus on a WinCE device
  17. Debugging with a log file
  18. Current Directory and Placement of DLLs
  19. Going Full Screen
  20. Removing the top taskbar
  21. Removing the Virtual Keyboard
  22. Alternative way with SHFullScreen
  23. Rotating the Screen
  24. Getting the Current Display Settings
  25. Enumerating All Supported Display Settings
  26. Changing Display Settings
  27. Pre-compiled Windows CE Libraries/Utils
  28. Pre-compiled sqlite dll
  29. OpenSSL for Windows CE
  30. Other Interfaces
  31. Platform specific Tips
  32. Interface Development Articles
  33. See also
  34. WinCE Programming Tips
  35. Contents
  36. TIPS / FAQ
  37. The error message: SomeProject is not a valid Windows CE application
  38. Application runs on Windows Device Emulator, but not on physical device
  39. Missing aygshell.dll
  40. Wrong architecture
  41. Missing functions due to Operating System version
  42. Get Device ID
  43. Get Device Name
  44. Show/Hide SIP Panel
  45. Wakeup Device/ Power On
  46. LED / Vibrator
  47. Getting Battery Status
  48. Prevent Phone from Entering in Standby Mode
  49. Installation of an app build with Lazarus on a WinCE device
  50. Debugging with a log file
  51. Current Directory and Placement of DLLs
  52. Going Full Screen
  53. Removing the top taskbar
  54. Removing the Virtual Keyboard
  55. Alternative way with SHFullScreen
  56. Rotating the Screen
  57. Getting the Current Display Settings
  58. Enumerating All Supported Display Settings
  59. Changing Display Settings
  60. Pre-compiled Windows CE Libraries/Utils
  61. Pre-compiled sqlite dll
  62. OpenSSL for Windows CE
  63. Other Interfaces
  64. Platform specific Tips
  65. Interface Development Articles
  66. See also

WinCE Programming Tips

This article applies to WinCE only.

Contents

TIPS / FAQ

The error message: SomeProject is not a valid Windows CE application

This is a generic error message from Windows CE which can be caused by one of the following reasons:

  • The executable was compiled for a different Operating System, for example desktop Windows
  • The executable was compiled for a different architecture then the device has
  • One of the DLLs which the device requires could not be found. Usually this is either a database dll or aygshell.dll. See further in this FAQ about those
  • The binary is too big and doesn’t fit the available RAM

Unfortunately Windows CE does not give specific error messages in this case, so one should simply test all hypotheses.

Application runs on Windows Device Emulator, but not on physical device

When running a compiled application on the Windows Device emulator, it works fine, but running it on the physical device you get the error:

Cannot find ‘project1’ (or one of its components).

Possible causes are:

Missing aygshell.dll

This error is usually indicative of missing DLLs on the target device, especially if you have a very simple «Hello World» type of application. In many instances, it is related to the aygshell.dll file, which is not present on many industrial-type devices running a bare Windows CE version — normally devices running «Windows Mobile» versions of Windows CE will not have this problem.

This problem has been reported on Motorolla/Symbol MC9000 and MC1000 barcode scanners running both Windows CE 4.2 and 5.

To resolve, do a search for «aygshells.zip» in a search engine — there are some «Dummy» aygshell.dll files available that can be copied to the device to overcome this problem.

Here is a list of forum topics where people had trouble with aygshell.dll and found a solution:

And here a number of DLLs to substitute missing ones and make applications work:

Wrong architecture

Maybe your device runs a x86 or mips processor instead of the more common ARM.

Missing functions due to Operating System version

Possibly your operating system is very old and doesn’t have some functions required by Lazarus.

Get Device ID

Get and ID of your device useful for protect your application. This work only on Windows Mobile 5.0 and Windows CE 5.1

Get Device Name

Easy to get it from registry

Show/Hide SIP Panel

SIP: Software Input Panel button, it is a keyboard come with WinCE for touch screen devices.

Microsoft documentation for the SipShowIM routine: [1]

Wakeup Device/ Power On

If you like to make alarm application this function make your device power on, you need also make some sounds with it.

LED / Vibrator

You can turn on/off then LED/vibrator in, your device, it worked for me but not as like as i want, may be it need some improvements.

Vibrator it is the last LED in your device, if you can write some music you can now make your phone dance.

Getting Battery Status

Prevent Phone from Entering in Standby Mode

Inside a timer event add the following line of code:

Installation of an app build with Lazarus on a WinCE device

The simplest way to install an app is to simply copy the executable and other files it needs, but a proper installer can be made with the instructions bellow: 1) one needs a inf file (maybe Lazarus could generate one on his own some time. ). A good brief on how to create one can be found here: http://web.archive.org/web/20080205125046/http://www.sundialsoft.freeserve.co.uk/cabinfo.htm (original website is dead) I used the following (only for ARM prozessors):

Читайте также:  Паскаль под windows 10

2) now create a cab file out of your files using this inf file by using cabwiz.exe from the platform SDK of MS 3) generate a install.ini — my looks like this (icon-section is nor really needed. ):

5) generate the installer using the ini-file, a readme and a eula file you generated as txt files

be sure to have ActiveSync installed. double-click the installer and have fun 🙂

Debugging with a log file

Windows CE doesn’t ship with a command line, so people used to command-line log debugging may have trouble. In some versions of Windows CE it is possible to install a command-line, but another solution for this is using the logging routines from the LCLProc unit in Lazarus to write log information to a file in the same directory as the executable and then read it, as in the code bellow.

The unit LCLProc also contains other cool routines for debugging, like GetStackTrace, which returns a string with the stack trace.

Current Directory and Placement of DLLs

Windows CE does not have the concept of current directory, so paths to files should always be complete and never relative to the executable path.

As one exception to this rule, DLLs can be placed in the same folder as the executable and they will be loaded from there. Another suitable location for DLLs is the \Windows directory.

Going Full Screen

Making an application Fullscreen requires removing both the bottom menu bar and the top taskbar

Removing the top taskbar

This code should remove the taskbar by passing False to the parameter of this function:

Note that if you don’t provide a quit button it will be then impossible to close the application and that if the application crashes, the taskbar will not be restored automatically. Rebooting the device will restore it.

Removing the Virtual Keyboard

One can remove the keyboard with SHFS_HIDESIPBUTTON, like this:

Alternative way with SHFullScreen

This is a different solution for going Fullscreen. Make sure that you have included the windows unit to your program (uses windows;) In the INTERFACE section of your program paste the following code:

Then in your Forms, OnCreate or OnShow (better on the OnShow) event add the following code:

Rotating the Screen

There is a Microsoft tutorial with code in C here about this: http://msdn.microsoft.com/en-us/library/ms812499.aspx Bellow is code equivalent to that tutorial, but in Pascal.

Getting the Current Display Settings

To obtain the current display settings, pass the ENUM_CURRENT_SETTINGS constant in the iModeNum parameter to the EnumDisplaySettings API, as illustrated by the following Pascal code.

Enumerating All Supported Display Settings

To enumerate all display settings supported by the current display device pass zero in the iModeNum parameter to the EnumDisplaySettings API and then continue calling it with incremented iModeNum values until the function returns zero, as shown in the following Pascal code.

Changing Display Settings

To change the display settings pass in a pointer to a valid DEVMODE structure to the ChangeDisplaySettings API. The following Pascal code demonstrates how to rotate the screen orientation clockwise by 90 degrees. Note that this code will only work with devices that support the respective display settings. It is important to obey the return value of the ChangeDisplaySettings API as some operations may require the computer to be restarted in order for the graphics mode to work.

Pre-compiled Windows CE Libraries/Utils

Pre-compiled sqlite dll

You can find sqlite3.dll pre-compiled for Windows CE here.

OpenSSL for Windows CE

It is pretty hard to find a good binary OpenSSL library for Windows CE these days, so good versions which dont depend on any wierd, unusual library, are hosted here:

They were obtained from here: http://q3.snak.org/en/old.html and hosted on the link above in case this page goes offline

Other Interfaces

  • Lazarus known issues (things that will never be fixed) — A list of interface compatibility issues
  • Win32/64 Interface — The Windows API (formerly Win32 API) interface for Windows 95/98/Me/2000/XP/Vista/10, but not CE
  • Windows CE Interface — For Pocket PC and Smartphones
  • Carbon Interface — The Carbon 32 bit interface for macOS (deprecated; removed from macOS 10.15)
  • Cocoa Interface — The Cocoa 64 bit interface for macOS
  • Qt Interface — The Qt4 interface for Unixes, macOS, Windows, and Linux-based PDAs
  • Qt5 Interface — The Qt5 interface for Unixes, macOS, Windows, and Linux-based PDAs
  • GTK1 Interface — The gtk1 interface for Unixes, macOS (X11), Windows
  • GTK2 Interface — The gtk2 interface for Unixes, macOS (X11), Windows
  • GTK3 Interface — The gtk3 interface for Unixes, macOS (X11), Windows
  • fpGUI Interface — Based on the fpGUI library, which is a cross-platform toolkit completely written in Object Pascal
  • Custom Drawn Interface — A cross-platform LCL backend written completely in Object Pascal inside Lazarus. The Lazarus interface to Android.

Platform specific Tips

  • Android Programming — For Android smartphones and tablets
  • iPhone/iPod development — About using Objective Pascal to develop iOS applications
  • FreeBSD Programming Tips — FreeBSD programming tips
  • Linux Programming Tips — How to execute particular programming tasks in Linux
  • macOS Programming Tips — Lazarus tips, useful tools, Unix commands, and more.
  • WinCE Programming Tips — Using the telephone API, sending SMSes, and more.
  • Windows Programming Tips — Desktop Windows programming tips
Читайте также:  Windows server 2019 evaluation edition

Interface Development Articles

  • Carbon interface internals — If you want to help improving the Carbon interface
  • Windows CE Development Notes — For Pocket PC and Smartphones
  • Adding a new interface — How to add a new widget set interface
  • LCL Defines — Choosing the right options to recompile LCL
  • LCL Internals — Some info about the inner workings of the LCL
  • Cocoa Internals — Some info about the inner workings of the Cocoa widgetset

See also

Here are some links that might be useful for creating Windows CE interfaces.

WinCE Programming Tips

This article applies to WinCE only.

Contents

TIPS / FAQ

The error message: SomeProject is not a valid Windows CE application

This is a generic error message from Windows CE which can be caused by one of the following reasons:

  • The executable was compiled for a different Operating System, for example desktop Windows
  • The executable was compiled for a different architecture then the device has
  • One of the DLLs which the device requires could not be found. Usually this is either a database dll or aygshell.dll. See further in this FAQ about those
  • The binary is too big and doesn’t fit the available RAM

Unfortunately Windows CE does not give specific error messages in this case, so one should simply test all hypotheses.

Application runs on Windows Device Emulator, but not on physical device

When running a compiled application on the Windows Device emulator, it works fine, but running it on the physical device you get the error:

Cannot find ‘project1’ (or one of its components).

Possible causes are:

Missing aygshell.dll

This error is usually indicative of missing DLLs on the target device, especially if you have a very simple «Hello World» type of application. In many instances, it is related to the aygshell.dll file, which is not present on many industrial-type devices running a bare Windows CE version — normally devices running «Windows Mobile» versions of Windows CE will not have this problem.

This problem has been reported on Motorolla/Symbol MC9000 and MC1000 barcode scanners running both Windows CE 4.2 and 5.

To resolve, do a search for «aygshells.zip» in a search engine — there are some «Dummy» aygshell.dll files available that can be copied to the device to overcome this problem.

Here is a list of forum topics where people had trouble with aygshell.dll and found a solution:

And here a number of DLLs to substitute missing ones and make applications work:

Wrong architecture

Maybe your device runs a x86 or mips processor instead of the more common ARM.

Missing functions due to Operating System version

Possibly your operating system is very old and doesn’t have some functions required by Lazarus.

Get Device ID

Get and ID of your device useful for protect your application. This work only on Windows Mobile 5.0 and Windows CE 5.1

Get Device Name

Easy to get it from registry

Show/Hide SIP Panel

SIP: Software Input Panel button, it is a keyboard come with WinCE for touch screen devices.

Microsoft documentation for the SipShowIM routine: [1]

Wakeup Device/ Power On

If you like to make alarm application this function make your device power on, you need also make some sounds with it.

LED / Vibrator

You can turn on/off then LED/vibrator in, your device, it worked for me but not as like as i want, may be it need some improvements.

Vibrator it is the last LED in your device, if you can write some music you can now make your phone dance.

Getting Battery Status

Prevent Phone from Entering in Standby Mode

Inside a timer event add the following line of code:

Installation of an app build with Lazarus on a WinCE device

The simplest way to install an app is to simply copy the executable and other files it needs, but a proper installer can be made with the instructions bellow: 1) one needs a inf file (maybe Lazarus could generate one on his own some time. ). A good brief on how to create one can be found here: http://web.archive.org/web/20080205125046/http://www.sundialsoft.freeserve.co.uk/cabinfo.htm (original website is dead) I used the following (only for ARM prozessors):

2) now create a cab file out of your files using this inf file by using cabwiz.exe from the platform SDK of MS 3) generate a install.ini — my looks like this (icon-section is nor really needed. ):

5) generate the installer using the ini-file, a readme and a eula file you generated as txt files

be sure to have ActiveSync installed. double-click the installer and have fun 🙂

Debugging with a log file

Windows CE doesn’t ship with a command line, so people used to command-line log debugging may have trouble. In some versions of Windows CE it is possible to install a command-line, but another solution for this is using the logging routines from the LCLProc unit in Lazarus to write log information to a file in the same directory as the executable and then read it, as in the code bellow.

Читайте также:  What is windows kernel debugger

The unit LCLProc also contains other cool routines for debugging, like GetStackTrace, which returns a string with the stack trace.

Current Directory and Placement of DLLs

Windows CE does not have the concept of current directory, so paths to files should always be complete and never relative to the executable path.

As one exception to this rule, DLLs can be placed in the same folder as the executable and they will be loaded from there. Another suitable location for DLLs is the \Windows directory.

Going Full Screen

Making an application Fullscreen requires removing both the bottom menu bar and the top taskbar

Removing the top taskbar

This code should remove the taskbar by passing False to the parameter of this function:

Note that if you don’t provide a quit button it will be then impossible to close the application and that if the application crashes, the taskbar will not be restored automatically. Rebooting the device will restore it.

Removing the Virtual Keyboard

One can remove the keyboard with SHFS_HIDESIPBUTTON, like this:

Alternative way with SHFullScreen

This is a different solution for going Fullscreen. Make sure that you have included the windows unit to your program (uses windows;) In the INTERFACE section of your program paste the following code:

Then in your Forms, OnCreate or OnShow (better on the OnShow) event add the following code:

Rotating the Screen

There is a Microsoft tutorial with code in C here about this: http://msdn.microsoft.com/en-us/library/ms812499.aspx Bellow is code equivalent to that tutorial, but in Pascal.

Getting the Current Display Settings

To obtain the current display settings, pass the ENUM_CURRENT_SETTINGS constant in the iModeNum parameter to the EnumDisplaySettings API, as illustrated by the following Pascal code.

Enumerating All Supported Display Settings

To enumerate all display settings supported by the current display device pass zero in the iModeNum parameter to the EnumDisplaySettings API and then continue calling it with incremented iModeNum values until the function returns zero, as shown in the following Pascal code.

Changing Display Settings

To change the display settings pass in a pointer to a valid DEVMODE structure to the ChangeDisplaySettings API. The following Pascal code demonstrates how to rotate the screen orientation clockwise by 90 degrees. Note that this code will only work with devices that support the respective display settings. It is important to obey the return value of the ChangeDisplaySettings API as some operations may require the computer to be restarted in order for the graphics mode to work.

Pre-compiled Windows CE Libraries/Utils

Pre-compiled sqlite dll

You can find sqlite3.dll pre-compiled for Windows CE here.

OpenSSL for Windows CE

It is pretty hard to find a good binary OpenSSL library for Windows CE these days, so good versions which dont depend on any wierd, unusual library, are hosted here:

They were obtained from here: http://q3.snak.org/en/old.html and hosted on the link above in case this page goes offline

Other Interfaces

  • Lazarus known issues (things that will never be fixed) — A list of interface compatibility issues
  • Win32/64 Interface — The Windows API (formerly Win32 API) interface for Windows 95/98/Me/2000/XP/Vista/10, but not CE
  • Windows CE Interface — For Pocket PC and Smartphones
  • Carbon Interface — The Carbon 32 bit interface for macOS (deprecated; removed from macOS 10.15)
  • Cocoa Interface — The Cocoa 64 bit interface for macOS
  • Qt Interface — The Qt4 interface for Unixes, macOS, Windows, and Linux-based PDAs
  • Qt5 Interface — The Qt5 interface for Unixes, macOS, Windows, and Linux-based PDAs
  • GTK1 Interface — The gtk1 interface for Unixes, macOS (X11), Windows
  • GTK2 Interface — The gtk2 interface for Unixes, macOS (X11), Windows
  • GTK3 Interface — The gtk3 interface for Unixes, macOS (X11), Windows
  • fpGUI Interface — Based on the fpGUI library, which is a cross-platform toolkit completely written in Object Pascal
  • Custom Drawn Interface — A cross-platform LCL backend written completely in Object Pascal inside Lazarus. The Lazarus interface to Android.

Platform specific Tips

  • Android Programming — For Android smartphones and tablets
  • iPhone/iPod development — About using Objective Pascal to develop iOS applications
  • FreeBSD Programming Tips — FreeBSD programming tips
  • Linux Programming Tips — How to execute particular programming tasks in Linux
  • macOS Programming Tips — Lazarus tips, useful tools, Unix commands, and more.
  • WinCE Programming Tips — Using the telephone API, sending SMSes, and more.
  • Windows Programming Tips — Desktop Windows programming tips

Interface Development Articles

  • Carbon interface internals — If you want to help improving the Carbon interface
  • Windows CE Development Notes — For Pocket PC and Smartphones
  • Adding a new interface — How to add a new widget set interface
  • LCL Defines — Choosing the right options to recompile LCL
  • LCL Internals — Some info about the inner workings of the LCL
  • Cocoa Internals — Some info about the inner workings of the Cocoa widgetset

See also

Here are some links that might be useful for creating Windows CE interfaces.

Оцените статью