1 / 27

Module 3: Preparing an Application Development Environment

Module 3: Preparing an Application Development Environment. Overview. Exporting an SDK from Platform Builder Importing an SDK Win32 Programming Primer. Exporting an SDK from Platform Builder. Need for an SDK The Exporting Process. Need for an SDK. Platform Builder. Custom SDK.

alvaro
Download Presentation

Module 3: Preparing an Application Development Environment

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Module 3: Preparing an Application Development Environment

  2. Overview • Exporting an SDK from Platform Builder • Importing an SDK • Win32 Programming Primer

  3. Exporting an SDK from Platform Builder • Need for an SDK • The Exporting Process

  4. Need for an SDK Platform Builder Custom SDK Windows CE Toolkits Windows CE OS configuration Libraries Toolkits for Visual C++ Header files Run-time libraries Help files OAL Runtime files Device drivers Platform extension Toolkits for Visual Basic Platform Manager components

  5. The Exporting Process • You Must Build A Platform Before Exporting an SDK • Menu : Platform/Export SDK • Choose Add-on technologies (MFC, ATL, Console application) • Select configuration • Check Platform Manager Transport Layer

  6. Importing an SDK • Importing to Embedded Visual C++ • Importing to Embedded Visual Basic • Using the Platform Manager

  7. Importing to Embedded Visual C++ • Decompress SDK into \Windows CE Tools directory • Run Embedded Visual C++ • Select File | New… then [Projects] tab • Select Active WCE Configuration on WCE Configuration Toolbar. • Example:

  8. Importing to Embedded Visual Basic • Decompress SDK into \Windows CE Tools directory • Run Embedded Visual Basic • Select File | New Project • On New Project Window, Select: • Windows CE Formless Project • Platform-Specific Project

  9. Using Platform Manager • Platform Manager manages the interaction between desktop and target platform • Operates with toolkits (Visual C++, Visual Basic) to download applications • Connects target platform with remote tools • Target-side and host-side components • The target side - built by Platform Builder in your Windows CE image • The host side - created by toolkits with the exported custom SDK

  10. Win32 Programming Primer • Creating a Win32 Application • Useful Win32 Functions • The Unicode Character Set • Processes and Threads • Structured Exception Handling

  11. Creating a Win32 Application

  12. Creating a Win32 Application (continued)

  13. Creating a Win32 Application (continued)

  14. Useful Win32 Functions • MessageBox – Displays message window • Example: MessageBox(NULL, _T("Hello"), _T("Title"), 0); • NKDbgPrintfW – Format & debug output • Example: NKDbgPrintfW(_T("Value is %d\n\r"), iVal);

  15. Unicode - Compiler Support • ANSI Characters and Strings: • ‘H’ • “Hello Unicode” • ==> Store as ‘char’ or ‘unsigned char’ • Unicode Characters and Strings: • L’H’ • L”Hello Unicode” • ==> Store as “short’ or ‘unsigned short’ • Bi-Modal (_UNICODE) • TEXT(‘H’) • TEXT(“Hello Unicode”)

  16. Unicode - Data Types • ANSI • CHAR - resolves to char • LPSTR - resolves to char * • Unicode • WCHAR - resolves to unsigned short • LPWSTR - resolves to unsigned short * • Bi-Modal (_UNICODE) • TCHAR - resolves to char or unsigned short • LPTSTR - resolves to char * or unsigned short *

  17. Unicode - C-Runtime Functions • ANSI • strlen() - query length • strcpy() - copy string • strcat() - concatenate string • Unicode • wcslen() - query length • wcscpy() - copy string • wcscat() - concatenate string • Bi-Modal (_UNICODE) • _tcslen() - query length • _tcscpy() - copy string • _tcscat() - concatenate string

  18. Unicode - C-Runtime Conversion Functions • Converting to Unicode • mbstowcs( • wchar_t*wcstr, // Output string. • constchar*mbstr, // Input string. • size_tcount); // Character count. • Converting From Unicode • wcstombs( • char*mbstr, // Output string. • constwchar_t*wcstr, // Input string. • size_tcount); // Character count.

  19. Processes and Threads • Processes • Maximum 32 processes can be loaded at the same time • Support for console applications • Threads • Smallest unit of execution • Number of threads only limited by available memory • Preemptive priority-based scheduling (256 priorities) • Quantum default length is 100ms (configurable)

  20. Processes and Threads - Creating a Process CreateProcess( LPCTSTR lpszImageName, // EXE file name LPCTSTR lpszCmdLine, // Parameters LPSECURITY_ATTRIBUTES lpsaProcess, // = NULL LPSECURITY_ATTRIBUTES lpsaThread, // = NULL BOOL fInheritHandles, // Windows CE requires FALSE DWORD dwFlags, // See docs for details LPVOID lpEnvironment, // = NULL LPTSTR lpszCurDir, // Startup directory // = NULL LPSTARTUPINFO lpStart, // = NULL LPPROCESS_INFORMATION lppi); // Return handles

  21. Slot 32 Slot 31 Slot 30 . . . Slot 3 Slot 2 Slot 1 Slot 0 private.dll shared.dll coredll.dll App.Exe 64K NML Processes and Threads –System and Process Memory 1G 0 32M Address Space

  22. Processes and Threads - Thread API • Creating Threads: • CreateThread (Win32) • Suspending Threads: • SuspendThread (Win32) • ResumeThread (Win32) • Destroying Threads: • ExitThread (Win32) • TerminateThread (Win32)

  23. Structured Exception Handling - Exception Syntax __try { // Protected block. } __except (/* filter */ ) { // Exception handler. }

  24. Structured Exception Handling - The Filter // hard code a value __except (EXCEPTION_EXECUTE_HANDLER) __try { ... ... ... ... ... ... } __except ( ) { ... ... ... ... ... ... } // expression __except((GetExceptionCode()== EXCEPTION_ACCESS_VIOLATION) ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) // call a function __except (CheckIt(GetExceptionCode()) ... int CheckIt (DWORD dwCode) { switch (dwCode) { case xxxx:... } return EXCEPTION_EXECUTE_HANDLER; }

  25. Structured Exception Handling - Exception API • Create an exception VOID RaiseException(dwCode, dwFlags, cArgs, lpArgs) • Query exception DWORD GetExceptionCode (VOID) • Query abnormal termination BOOL AbnormalTermination (VOID) • Query exception information LPEXCEPTION_POINTERS GetExceptionInformation (void)

  26. Lab A: Exploring the Embedded Visual Tools 3.0

  27. Review • Exporting an SDK from Platform Builder • Importing an SDK • Win32 Programming Primer

More Related