Recent

Author Topic: WinCE application exit for no reason  (Read 10052 times)

bambamns

  • Full Member
  • ***
  • Posts: 223
WinCE application exit for no reason
« on: February 17, 2012, 06:07:37 pm »
Hi to all Lazarus people,

I have made one test application for WinCE with some nice API's like SHFullScreen (MoveWindow, ShowWindow) for full screan , GetSystemPowerStatusEx for battery status, GlobalMemoryStatus for memory status, SipShowIM for show and hide keyboard ... and everything work's like charm ... on startup screen (full screen) application monitors memory status (30Mb free), battery status  .... timer is set on 15s to refresh all those values and to show hours and minutes (app is full screen so user don't have those infromation from os screen) ....

Test device is HP Ipaq 6945.

So, what is problem - when I live application started , after a while, with no time rules it exit.
There is no debug file, no worning window before exit .... nothing.

I have tested it with keybd_event function , but it just make PDA not to go on sleep , still application exit with no rules.
When user is using application everything is working and it does not exit.

All API's are from Lazarus Wiki page with some little correction found on MSDN pages (like I've wrote - they work).

Till today I used Lazarus 0.9.30.2 and latest daily snapshots - currently I use Lazarus 0.9.31 build 35407 + fpc 2.6.0 with same arm build version.

Any help, idea ?
« Last Edit: February 25, 2012, 02:38:25 am by bambamns »
Lazarus 1.8.4 + FPC 2.6.4 x86 (rebuild) and Lazarus 2.0, Windows 7 x64, unless otherwise specified

bambamns

  • Full Member
  • ***
  • Posts: 223
Re: WinCE application exit for no reason
« Reply #1 on: February 24, 2012, 05:52:35 am »
Hi,

I'm answering to myself, but I hope it will help to other people.

1. Make timer with interval less then minute (my is 15 sec)
2. Declare two functions
    procedure SystemIdleTimerReset; stdcall; external 'coredll.dll';
    procedure SHIdleTimerReset; stdcall; external 'aygshell.dll' name 'SHIdleTimerReset';   
3. Call them in timer

If you use a real pocket pc like I do, it is very important for this kind of testing, to reset it after taking it down from cradle.

Very useful article can be found http://www.rdacorp.com/PDF/Windows%20Mobile%20Power%20Management.pdf .

So, there is a reason for unexpected application termination - it is WInCE power management.
« Last Edit: February 28, 2012, 08:19:19 pm by bambamns »
Lazarus 1.8.4 + FPC 2.6.4 x86 (rebuild) and Lazarus 2.0, Windows 7 x64, unless otherwise specified

abrito

  • Jr. Member
  • **
  • Posts: 69
Re: WinCE application exit for no reason
« Reply #2 on: March 01, 2014, 04:31:40 pm »
I have same problem but this declare procedures don't solve my problem.


Anyone else had this problem?

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: WinCE application exit for no reason
« Reply #3 on: March 01, 2014, 04:37:58 pm »
No idea, but perhaps the event log has some info:
http://www.ehow.com/how_6884771_look-events-log-windows-ce.html

Please also specify your Lazarus/FPC version when posting questions (see first link in signature below)... WinCE is apparently sensitive to which Lazarus version is used (in the sense that different Laz versions have different bugs... :) )
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

abrito

  • Jr. Member
  • **
  • Posts: 69
Re: WinCE application exit for no reason
« Reply #4 on: March 01, 2014, 05:15:31 pm »
Sorry for that.
I'm using
Typhon 4.70.

FPC 2.7.1 SVN:43727

can't find event log on my windows Mobile 6.1 Professional


abrito

  • Jr. Member
  • **
  • Posts: 69
Re: WinCE application exit for no reason
« Reply #5 on: March 01, 2014, 11:46:46 pm »
I noticed one more thing happens when wifi makes a reconnection or an update.
With wifi off, everything is ok.

when i connect usb cable of doc activesync connects and bummm, application terminate.

What could be causing this sudden end of program?
« Last Edit: March 02, 2014, 02:42:09 am by abrito »

abrito

  • Jr. Member
  • **
  • Posts: 69
Re: WinCE application exit for no reason
« Reply #6 on: March 04, 2014, 11:35:11 pm »
I'm answering to myself, but I hope it will help to other people.

After compressing with upx the problem disappeared.

bambamns

  • Full Member
  • ***
  • Posts: 223
Re: WinCE application exit for no reason
« Reply #7 on: March 11, 2014, 05:41:38 am »
It's look like there is a memory issue.

After all - it is important the problem is solved.

Try to use Lazarus 1.2 because it use FPC 2.6.2.
FPC 2.7.1 had a few problems with WinCE (I don't know they fixed them).
Lazarus 1.8.4 + FPC 2.6.4 x86 (rebuild) and Lazarus 2.0, Windows 7 x64, unless otherwise specified

chrgra

  • Jr. Member
  • **
  • Posts: 69
Re: WinCE application exit for no reason
« Reply #8 on: March 15, 2014, 06:18:26 pm »
The isssue is between freepascal 2.20 and 2.22.
Before that you can build anything.
Afterthat you got issues like this.

Even on two devices that should be the same. (spbbackup claims that it are two different roms, so there must be a difference between these devices.

One device will crash regarding connection manager (connecting/disconnecting wifi), the other not.

So I tried upx391w and it's seem to be stable with a firebird native client server application.

Uncompressed 3mb compressed 850k

Cheers Chris