Windows CE Interface/ko
This article applies to Windows CE only.
See also: Multiplatform Programming Guide
│
English (en) │
français (fr) │
한국어 (ko) │
português (pt) │
中文(台灣) (zh_TW) │
소개
Windows CE Interface는 Felipe Monteiro de Carvalho에 의해 시작되었고 이후 Roozbeh와 다른 공헌자에의해 확장되었다. 인터페이스는 아직도 개발중인 Windows CE FPC 컴파일러와 함께 2006년 시작되었다. 안정된 컴파일러는 2007년에 릴리즈 되어 0.9.24 Lazarus 릴리즈와 함게 WinCE 애드-온 인스톨러를 릴리즈 할 수 있게 하였다.
과거 gtk/gtk2 인터페이스를 유사한 인터페이스간에 코드공유했을 때의 나쁜 경험이 있었기 때문에, WinCE에서는 새로운 코드로 시작 하기로 결정하였다. API들은 매우 유사하기 때문에 WinCE 인터페이스상의 많은 코드는 Win32/64 인터페이스에서 복사해 왔다.
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
윈도우즈 CE 인터페이스 설정
윈도우즈 CE 인터페이스를 설정하기휘해서는 애드-온 인스톨러를 사용하거나 직접 인터페이스를 설정하여야 한다. 두가지 옵션이 아래에 자세히 설명되어 있다. 물론 애드-온 인스톨러를 사용하는 것이 편리하다.
안정된 애드-온 인스톨러 사용
윈도우즈 CE를 위한 첫번째의 안정된 프리파스칼에서 WinCE 개발환경을 설치하는 것는 결코 쉽지 않았다. 아레에 있는 각 단계를 따라 하기만 하면 설치할 수 있고 WinCE 응용프로그램을 컴파일 할 수 있도록 라자루스를 구성해준다.
단계별 가이드:
- SourceForge에서 최신판의 윈도우용 라자루스를 받아 설치한다: http://sourceforge.net/project/showfiles.php?group_id=89339
- 애드-온 인스톨러(cross-arm-wince)를 다운로드하여 설치한다. 방금 설치한 라자루스 버전과 동일한 버전으로 한다. 소스포지 다운로드 페이지에 같이 있다.
- arm-wince 응용프로그램을 컴파일러 옵션을 변경 한 후 라자루스에서 컴파일 할 수 있다:
- Environment -> Environment Options... -> Files -> Compiler Path: ppcrossarm으로 경로를 설정(eg C:\lazarus\fpc\2.2.2\bin\i386-win32\ppcrossarm.exe)
- Projects -> Compiler Options... -> Paths -> LCL Widget Type: wince
- Projects -> Compiler Options... -> Code -> Target OS: wince
- Projects -> Compiler Options... -> Code -> Target CPU Family: arm
- 빌드 파일 크기를 줄이기 위해 Projects -> Compiler Options... -> Debugging section에서 Strip 심볼을 체크하고 나머지는 모두 체크 해제 한다.
스냅샷 애드-온 인스톨러 사용
안정된 릴리즈를 사용하는 대신, 최신의 윈도우즈 CE 인터페이스 개발 버전을 사용할 수 있다. 이것은 테스트되지 않았으나 최신판이 릴리즈 된 후 어떤 것들이 추가되었는지에 따라 추가 설치하고자 할 때와 모든 것을 스스로 빌드하기에는 너무 어렵거나 많은 작업이 필요할 때 유용하다.
단계별 가이드:
- 최신의 윈도우즈용 리자루스 스냅샷을 이곳에서 받아 설치한다. Win32 스냅샷을 정확히 WinCE 스냅샷 버전과 같은이 확인한다: http://www.hu.freepascal.org/lazarus/
- 방금 다운로드한 프리파스칼 버전과 같은 애드-온 인스톨러를 받아 설치한다.같은 페이지에 있다.
- 나머지 단게는 안정된 애드-온 인스톨러를 사용하는 단계별 가이드와 유사하다.
윈도우즈 CE 인터페이스를 수작업으로 설정하기
0.9.24 릴리즈가 안정된 윈도우 CE FPC 컴파일러 버전이 2.2.0 으로 만들었지만 현재의 라자우스 개발 버전은 2.2.1 또는 상위 버전을 필요로 한다. 다음에 이 환경을 설정할 수 있는 지침이 있다:
1단계 - 컴파일러를 윈도우상에서 재컴파일하여 윈도우 CE - ARM 크로스 컴파일러를 만들어 시작을 한다. 이곳에 셜명이 있다: WinCE port.
- TortoiseSVN을 사용하여 최신의 2.2.1을 확인한다: http://svn.freepascal.org/svn/fpc/branches/fixes_2_2/
- 그리고 나서 다음과 같이 배치 스크립트를 만들어, 설치된 FPC 2.2.1(또는 라자루스나 별도로 설치된 것으로부터)에서 컴파일러를 빌드한다.
cd compiler PATH=C:\Programas\lazarus220\fpc\2.2.0\bin\i386-win32 make cycle CPU_TARGET=arm OS_TARGET=wince cd .. pause
2단계 - 새롭게 빌드한 컴파일과 함께 FCL(Free Component Library)을 컴파일 할 필요가 있다. 설명 이곳.
- 이 똑똑한 배치 스크립트는 이 일들을 쉽게 만들어 준다(패스를 각자의 컴퓨터세 맞게 고치는 것을 꼭 기억하라). OPT="-FU...는 코든 컴파일된 유닛을 같은 위치에 넣어줄 것이고, 이는 매우 편리하다.(그러나 문제를 일으킬 수 있다). 모든 install 대신 make clean을 사용하는 것이 좋다:
cd packages PATH=C:\Programas\lazarus220\fpc\2.2.1\bin\i386-win32 make clean all CPU_TARGET=arm OS_TARGET=wince PP=ppcrossarm.exe OPT="-FUC:\Programas\lazarus220\fpc\2.2.1\units\arm-wince" cd .. pause
3단계 - 아래에 있는 배치파일을 서브버전의 라자우스 디렉토리의 루트에 넣고 실행하라
PATH=C:\Programas\lazarus22\fpc\2.2.1\bin\i386-win32;c:\Programas\arm make lcl LCL_PLATFORM=wince PP=ppcrossarm.exe CPU_TARGET=arm OS_TARGET=wince pause
이것은 LCL을 윈도우 CE로 컴파일한다.
4단계 - LazarusPackageIntf를 크로스-컴파일하면 써드파티 비쥬얼 컴포넌트를 사용할 수 있다. lazarus\packager\registration으로 가서 실행하라:
PATH=C:\Programas\lazarus22\fpc\2.2.1\bin\i386-win32;c:\Programas\arm make PP=ppcrossarm.exe CPU_TARGET=arm OS_TARGET=wince pause
노트: $(LazarusDir)\packager\units\$(TargetCPU)-$(TargetOS)\를 당신의 프로젝트의 유닛 경로에 지정을 해야한다(요구사항이 한것처럼 FCL을 추가)
5단계 - 이제 라자루스 IDE를 사용하여 프로그램을 디자인, 컴파일하고 디버그 할 수 있다.
- 스크립트를 사용하여 당신의 프로그램을 컴파일하는 것과 비슷하게 사용할 수 있다.
PATH=C:\Programas\lazarus22\fpc\2.2.1\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
라자루스 IDE에서 윈도우CE 프로젝트 파일 컴파일하기
노트: 최근 "wincemenures.or"파일이 링크시에 누락된다는 보고가 있다. 이 파일을 "lazarus/lcl/interfaces/wince"에서 "lazarus/lcl/units/arm-wince"로 복사하기만 하면 모든 것이 잘 될 것이다.
모든 것이 다른 인터페이스와 OS에서 되듯이 잘 될 것이다. 위젯 셋으로 Compiler Options->Paths과 Code탭 페이지 선택에서 WinCE를 타겟 OS로 타겟 CPU는 arm으로 선택하여 WinCe를 선택했음을 명심하라. Environment options에 있는 compiler path를 ppcrossarm.exe 컴파일러가 있는 곳으로 변경해야 한다.
새로운 IDE는 당신의 새로운 파일을 컴파일할 준비가 되어있다.
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
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 128mg 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.
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 Micrososft ActiveSync Go to the menu File->Get connected.If still ActiveSync doesn't recognize the emulator.Uncradle and Cradle the emulator again.
Step 4 - Copy that file with File Explorer program in your emulator to \gdb directory.If it is your first time running emulator you have to create a gdb directory in 'My Pocket PC' folder which is your root(\) folder.(To make things even faster for your each build,with file explorer go to your shared folder,press ctrl+c in your exe file,go to \gdb folder and each time before you try to debug your application just press ctrl+v)
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.
Some Hints
1. Programs remain in memory still after exiting from them. So you can't overwrite the .exe file. You have to use tools like Process Viewer from Microsoft which remotely shows all processes and allow you to kill them. Or use process killers inside the emulator. Process Explorer is another good option. One can get it from http://madebits.com
2. Each time you are done with debugging your program don't exit from program.Do program Reset and then Debugger reset. Note that sometimes still program remain in memory,so you also have to kill the process too.
Installing and Using the Pocket PC 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.
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". Now 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
Bellow 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 ):
LazCalendar - A simple calendar application:
germesorders - A simple database application using sqlite and RxLib
ZzOo, pronounced /'zi:zu:/, is a free Western Zodiac sign finder.
See Also
- Windows CE Interface Development notes
- Alternative Lazarus Windows CE tutorial using Win64
- Roadmap for the Windows CE interface
- Mini framework for WindowsCE applications: pkMiniGUI.pas Documentation
- KOL GUI 라이브러리의 WinCE 포트 - WinCE/Win32에 대한 경량의 어플리케이션.
- WinCE 포트 - 포트(port)의 컴파일러에 특정적인 부분