windows mobile programming usinb basic4ppc

Upload: meeraneela0808

Post on 08-Apr-2018

218 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/7/2019 Windows Mobile Programming usinb basic4ppc

    1/30

    Windows Mobile Programming

    L. Ramkumar (PhD)

    Vision Technologies (HP Education)

  • 8/7/2019 Windows Mobile Programming usinb basic4ppc

    2/30

    Windows Mobile is a mobile operating system

    developed by Microsoft that was used in

    smartphones and mobile devices, but is being

    currently phased out to specialized markets.

  • 8/7/2019 Windows Mobile Programming usinb basic4ppc

    3/30

    Basic4ppc

    Basic4ppc is a programming language

    designed for mobile applications

    development.

    With Basic4ppc you can develop programs

    directly on the Pocket PC / Window Mobile or

    on the desktop.

  • 8/7/2019 Windows Mobile Programming usinb basic4ppc

    4/30

    Basic4ppc includes a full featured Visual

    Designer.

    Basic4ppc applications can be compiled tonative executable (EXE files) without any

    additional runtimes.

  • 8/7/2019 Windows Mobile Programming usinb basic4ppc

    5/30

    Basic4ppc supports: Windows CE 5.0,

    Windows CE 6.0, Windows Mobile 2003,

    Windows Mobile 5.0, Windows Mobile 6.0,

    Windows Mobile 6.1 and Windows Mobile

    6.5. Basic4ppc supports both touch screen

    devices and non-touch screen devices (the

    device IDE is only supported on touch screendevices).

  • 8/7/2019 Windows Mobile Programming usinb basic4ppc

    6/30

    Basic4ppc v6.90 introduces the

    following new features:

    Local variables can be declared with a specifictype. Declaring numeric variables significantlyboosts the performance of numeric calculations.

    Subs parameters types and subs return type canalso be declared.

    New types: Number and Integer. Correspond to.Net Double and Int32.

    Subs parameters can be passed by reference(ByRef). This can be used to return several valuesfrom a sub.

  • 8/7/2019 Windows Mobile Programming usinb basic4ppc

    7/30

    Improved syntax for working with dynamic objects anddynamic controls. Instead of writing Control(ControlName,ControlType), it is now possible to writeControlType(ControlName). The desktop IDE fully supports

    the new syntax with autocomplete and with the usualpopup menu.

    Desktop forms size and layout is more accurate now.

    Scroll bar indicators. The desktop IDE now shows usefulindicators above the vertical scroll bar that helps with the

    code navigation. FileFlush keyword. Writes any cached data to the file.

    SQL library was updated to SQLite 3.6.16.

    More clear error messages for many common mistakes.

  • 8/7/2019 Windows Mobile Programming usinb basic4ppc

    8/30

    Modules

    Basic4ppc projects are made of one main file,

    with the extension "sbp" and any number of

    modules files, with the extension "bas".

    The main file holds the main module.

    A module can include code, forms and

    controls and objects.

  • 8/7/2019 Windows Mobile Programming usinb basic4ppc

    9/30

    Subs

    All program code (including global variables

    definitions) is written inside Subs.

    Subs declaration starts with [Public|Private]Sub SubName (Parameters) [As ReturnType]

    and ends with End Sub.

  • 8/7/2019 Windows Mobile Programming usinb basic4ppc

    10/30

    Variables

    Variables can be either global or sub local.

    Local variables value can be used only while

    their parent sub is executing. Global variables values can be used

    everywhere.

    Global variables are variables that weredeclared (or used) in Sub Globals; all other

    variables are local.

  • 8/7/2019 Windows Mobile Programming usinb basic4ppc

    11/30

    Sub Globals

    a=20

    End Sub

    Sub App_Start

    b=10

    CalcVars

    End Sub

    Sub CalcVars

    Msgbox ("a = " & a)

    Msgbox ("b = " & b)

    End Sub

    Result:

    First msgbox will showa = 20

    Second msgbox willshow b =

    b is empty because it'slocal and wasn't

    assigned any value yetin this sub.

  • 8/7/2019 Windows Mobile Programming usinb basic4ppc

    12/30

    Array

    Sub Globals

    Dim Books (20)

    Dim Buffer (100) As Byte

    End Sub

  • 8/7/2019 Windows Mobile Programming usinb basic4ppc

    13/30

    Structure Variables

    Structures are variables with customized

    fields.

    Using structures the code can be clearer andbetter organized.

    Structures must be declared in Sub Globals

  • 8/7/2019 Windows Mobile Programming usinb basic4ppc

    14/30

    Sub Globals

    Dim Type(Name, ID, Age) person

    End Sub

    Sub App_Start

    person.Name = "John"

    person.ID = 1234567person.Age = 30

    End Sub

  • 8/7/2019 Windows Mobile Programming usinb basic4ppc

    15/30

    Controls

    Controls in Basic4ppc are global objects, which

    means that each control has a unique name

  • 8/7/2019 Windows Mobile Programming usinb basic4ppc

    16/30

    Operators

    Basic4ppc supports the following operators:

    +,-,*,/ Basic math operators

    ^ Power sign

    mod Modulus operator

    & String concatenation

    ' Remarks (REM is not supported)

    The underscore character ( _ ) is used as a line continuationcharacter.

    Long lines could be broken to shorter lines by putting anunderscore at the end of each line (except of the last one).

  • 8/7/2019 Windows Mobile Programming usinb basic4ppc

    17/30

    Conditions

    The simple conditions can be combined into a

    more complex condition using the logical

    operators and using parenthesis.

    Conditions are "short-circuit" conditions.

    Which means that the expressions will only be

    evaluated if they can affect the result.

    For example: IfStrLength(TextBox1.Text) > 4 AND

    StrAt(TextBox1.Text,4) = "a" Then msgbox(true).

  • 8/7/2019 Windows Mobile Programming usinb basic4ppc

    18/30

    Data Types

    Name Description Range

    Byte 8-bit unsigned integer 0 - 255

    Int16 16-bit signed integer -32768 - 32767Int32 32-bit signed integer -2,147,483,648 -

    2,147,483,647Int64 64-bit signer integer -9e18 - 9e18

    Single 32-bit floating point -3.4e38 - 3.4e38

    Double 64-bit floating point -1.79e308 - 1.79e308

    Boolean 8-bit boolean value True, FalseDecimal 96-bit integer value -79e27 - 79e27

    Char A Unicode character

    String

  • 8/7/2019 Windows Mobile Programming usinb basic4ppc

    19/30

    External Libraries and Objects

    As of version 4.00 Basic4ppc supports working

    with external libraries.

    The external libraries are dll files whichinclude all kinds of new

    functionality.

  • 8/7/2019 Windows Mobile Programming usinb basic4ppc

    20/30

    Code Files

    Basic4ppc supports separating the code into

    several files.

    A project must include one main sbp file. Theother files are regular text files.

    Breaking the code into several files can be

    handy when building large applications, or

    when there is a need to write different code

    for the desktop and the device.

  • 8/7/2019 Windows Mobile Programming usinb basic4ppc

    21/30

    Menu Editor

    The menu editor allows you to add menu

    items to a form.

    Reaching the menu editor is done through theVisual Designer - Controls - Menu Editor.

  • 8/7/2019 Windows Mobile Programming usinb basic4ppc

    22/30

    Visual Designer

    The Visual Designerallows you to buildyour GUI with littleeffort.

    To open theDesigner, chooseMenu - Design -Create New Form

    (or one of thealready createdforms, if any).

  • 8/7/2019 Windows Mobile Programming usinb basic4ppc

    23/30

    Compiling

    Compiled files can target Windows EXE

    (desktop), Device EXE (Pocket PC / Windows

    Mobile) and Smartphone EXE (Windows

    Mobile Smartphones).

  • 8/7/2019 Windows Mobile Programming usinb basic4ppc

    24/30

    Smartphone Applications

    The difference between a Smartphone device and a regular mobiledevice is that Smartphones do not have a touch screen.

    Some controls are not useful without a touch screen and thereforeare not supported (OS limitation).

    The following controls are not supported:

    Button

    Calendar

    ImageButton

    ListBox

    NumUpDown

    RadioBtn

    SaveDialog

  • 8/7/2019 Windows Mobile Programming usinb basic4ppc

    25/30

    Screen Size and Resolution

    As different devices have different screen sizes

    and different resolutions, creating an

    application that runs fine on all devices is not

    a simple task.

    The most common screen sizes are:

    QVGA - 240 * 320, dpi: 96 * 96

    VGA - 480 * 640, dpi: 192 * 192

  • 8/7/2019 Windows Mobile Programming usinb basic4ppc

    26/30

    Unicode

    Basic4ppc supports Unicode formatted as

    UTF-8.

    When working with a non-AS

    CII file make sureto save it as UTF-8.

  • 8/7/2019 Windows Mobile Programming usinb basic4ppc

    27/30

    Database

    Database applications use the Table control.

    The Table control stores data in rows (records).

    If you do not want to show the table directly,then change its Visible property to false and use

    the table only to access the data.

    Each row consists of several columns.

    Rows are accessed by their index (starting from 0)

    and columns are accessed by there names.

  • 8/7/2019 Windows Mobile Programming usinb basic4ppc

    28/30

    Demo

    Trail Version Available @ www. Basic4ppc.com

    MyMobiler to show the mobile display in PC

    ActiveSync to transfer files between your pcand windows mobile.

  • 8/7/2019 Windows Mobile Programming usinb basic4ppc

    29/30

    Questions ?

  • 8/7/2019 Windows Mobile Programming usinb basic4ppc

    30/30

    Thanks.