Difference between revisions of "Windows CE Development Notes"

From Free Pascal wiki
Jump to navigationJump to search
Line 76: Line 76:
  
 
[http://www.rainer-keuchel.de/wince/wince-api-diffs.txt Differences between normal Win32-API and WindowsCE (old wince)]
 
[http://www.rainer-keuchel.de/wince/wince-api-diffs.txt Differences between normal Win32-API and WindowsCE (old wince)]
 +
 +
[http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcesdkr/html/_Tools_CONTROL_Control.asp Resource-Definition Statements]
 +
 +
[http://www.autoitscript.com/autoit3/docs/appendix/GUIStyles.htm GUI Control Styles]

Revision as of 12:12, 23 April 2006

Debugging your applications

General infos are here Windows_CE_Interface#Debbuging Windows CE software on the Lazarus IDE

  • Sometimes gdb will crash,nothing to worry,just reset debugger and start again.
  • If you have an open call stack window it will take lots of time each time you trace/debug your program and sometimes crashes the debugger,so use it only when needed.
  • Always put breakpoints where needed you can not/or hardly can pause your program or even stop/reset it.
  • You can strip your program with --only-keep-debug which save you around 1mg.
  • Somethimes stepping takes lots of time,just be patinent,i've experienced once a simple assignment took 1min for debugger to execute that code.

Known Issues and bugs

SetProp - GetProp - RemoveProp APIs

Windows CE does not have SetProp and GetProp apis which is used a lot.So I have created/emulated those myself. The current implementation is not exactly as win32 apis.In win32 you can set multiple properties with diffrent names to each window but in wince names are just ignored so we only have one.(it is easy to implement that but i find it currently of no use) Also removeprop is not called yet!so a memory leak happens each time you exist the program.(i dont know if wince also frees memory itself or not when handles are destroyed..)

Exiting Programs

After you clicked the X exit button,you have to do something -like clicking somewhere-to make program exit. Reason not yet known.

LCLControlSizeNeedsUpdate LCLBoundsToWin32Bounds LCLFormSizeToWin32Size GetLCLClientBoundsOffset GetLCLClientBoundsOffset

I havent even bothered myself to know are these woking or not.I also dont think we need them as they exist in win32.So might require some redesigning.For example in TWinCEWSWinControl.SetBounds i had to remove movewindow becouse it moved it to nowhere.

Brushes

We dont have them as they are in win32,i've mapped CreateBrushIndirect to CreateSolidBrush and CreateDIBPatternBrushPt,other flags-if used in lcl-will fail.

Other Stuff

Well i dont know what call the following but these are things i know,and i thought you might know too!

External signal(?) error

From time to time you might see this from debugger.It is misaligned datatype error,which in normal cases you shouldnt see.There are some issues with this and compiler,so for now you only way is to typecast each type to byte and do assignments,compare on those.Or if it is someother kind of type,bigger than byte, you have to byte by byte transfer it into new temporary same type.

Graphics.pp

If you want labels being displayed you need to changed TTextStyle = packed record to TTextStyle = record It is becouse of bug in fpc compiler(i guess).

Menues

They require some extensive work.Need a little more background on how lcl handle menus and maybe some modifications to that too!

GetSysColor

This function is changed with flags ored with $40000000(becouse wince expect that) but i think the original values in sdk should be changed from windows and lcltypes units.Take a look at windows.h from pocketpc 2003 sdk. for example in lcltype COLOR_MENU = 4; but it should be like COLOR_MENU = 4 or SYS_COLOR_INDEX_FLAG; and {$ifdef wince}SYS_COLOR_INDEX_FLAG = $40000000;{$else}SYS_COLOR_INDEX_FLAG = 0{$endif} But changing these makes some other internal functions work wrong.If this approach choosed they need to be fixed.

Copy-pasted win32 code

Well yes wince interface is working,with not that much known bugs,but i think by removing and changing lots of current codes we can make wince interface faster and better. Also make sure to state descriptions of winapi from wince,currently it is same as win32,but sometimes they differ.


For Future

Currently programs compiled with Lazarus and WinCE Interface is optimized and expect to work only on PocketPc Devices. For them to work on Smartphones,we need to remove,or reimplement interfaces again. Also each version of wince adds and support more things,how we are going to use them not yet known!


Links

Here are some links that migh be usefull for creating windows ce interfaces

How to Port Your Win32 Code to Windows CE

Old but usefull article show flags required for creating wince controls

Page with nice descriptions of lots of flags

Adapting Application Menus to the CE User Interface

Differences between normal Win32-API and WindowsCE (old wince)

Resource-Definition Statements

GUI Control Styles