Developing Applications for the Palm-size PC with the Microsoft Windows CE Toolkit for Visual Basic 6.0

 

Summary: A Palm-size PC is a compact device that utilizes the Microsoft® Windows® CE operating system. Among the languages that developers can use to create applications for the Palm-size PC is Microsoft Visual Basic® version 6.0, a popular software development tool that provides rapid application development and is easy to use. Applications created with the Visual Basic 6.0 development system can range in size and scope from prototypes and small but very effective applications to extremely large, scalable applications. The Windows CE Toolkit for Visual Basic 6.0 provides a set of menus, tools, and toolbars that enhance the ability of developers using the Visual Basic programming system to create applications for Windows CE–based devices, including the Palm-size PC. (7 printed pages)

This paper explains the process of writing applications for the Palm-size PC using the Windows CE Toolkit for Visual Basic 6.0. It includes the following topics:

  • Installation of the toolkit
  • Application development using the toolkit, including design guidelines
  • Application testing
  • Issues pertaining to porting code from other platforms

Introduction

The Palm-size PC is a tool designed for professionals who use mobile devices. It is functional, yet it is unobtrusive in size and easy to use. With a Palm-size PC, you can access your personal and business information from any location at any time of day, through a variety of programs. For example, with personal information manager (PIM) software, you can keep track of contacts and appointments. You can use note-taking software to write down or record notes as well as use e-mail software to send and receive messages. Files and other information stored on a Palm-size PC can be synchronized with one or more desktop systems, ensuring consistency across all points of access.

The most recent release of the Palm-size PC is based on the most recent version of the Windows CE operating system. New features include the following:

  • Color displays

    Color brings enhanced readability to the Palm-size screen, paving the way for the development of more graphics-intensive applications. For example, you could design an application allowing a mobile-device user to take blueprints to a job site, make annotations in the files, and incorporate changes when the device is synchronized with the desktop computer. Color enhancement benefits entertainment software as well, such as games, electronic books, and Internet content.

  • Microsoft®TrueType® font support

    TrueType fonts offer a wider variety of font types and a wider range of font sizes.

  • Japanese language support

Microsoft provides a variety of toolkits and libraries to support developers who want to engineer applications for the Palm-size PC. Using these toolkits, you can create applications for the Palm-size PC in an integrated development environment (IDE) that is familiar, yet has been enhanced to provide the necessary functions to generate and debug Palm-size PC applications. With the Microsoft Windows CE Toolkit for Visual Basic 6.0 you can develop applications for a Palm-size PC using a subset of the Visual Basic language and ActiveX® controls. Similarly, the Microsoft Windows CE Toolkit for Visual C++® 6.0 gives you the necessary tools to develop Palm-size PC applications using the Visual C++ development system. Development may be further simplified using support libraries such as the Microsoft Foundation Classes (MFC).

Installing the Necessary Tools

To develop applications for the Palm-size PC using the toolkit, the following software components need to be installed on the development system:

  • Microsoft Windows NT® Workstation 4.0
  • Microsoft Visual Basic 6.0
  • Microsoft Windows CE Toolkit for Visual Basic® 6.0
  • Microsoft Windows CE Platform SDK, Palm-size PC Edition version 1.2
  • Microsoft Windows CE Services 2.2

Note that the Microsoft Windows NT operating system is required to support emulation. Developers who do not require device emulation may substitute the Microsoft Windows 95 or Microsoft Windows 98 operating system. An actual target device should be used for final application testing to ensure correct application operation.

Developing an Application for the Palm-size PC

The Windows CE Toolkit consists of an integrated set of menus, tools, and toolbars that augment the desktop IDE. Application development for the Palm-size PC using the toolkit closely parallels application development for the desktop using Visual Basic 6.0. The toolkit modifies the existing Visual Basic IDE to allow development for compact devices, but maintains a user interface that is consistent with the IDE used for desktop-application development. If you have created desktop applications with Visual Basic 6.0, you will be able to quickly learn the toolkit to produce applications for compact devices.

Note that Visual Basic for Windows CE is a subset of the Visual Basic language, so not all language constructs are available. Additionally, not all ActiveX controls are supported for use on the Palm-size PC.

The following topics describe the process of creating an application for the Palm-size PC.

To create a project

The first step in developing an application for the Palm-size PC using the toolkit is to create a new project. This process is similar to creating a new desktop-based project.

  1. Start Visual Basic 6.0.

  2. Choose Palm-size PC as the project template in the New Project dialog box.

    If Visual Basic 6.0 has been configured not to show the New Project dialog box at startup, choose New Project from the File menu, and the New Project dialog box will be displayed.

  3. The Project Properties dialog box will be displayed after the type of project has been chosen.

    The tabs in the Project Properties dialog box serve the following purposes:

    • General—specifies project information such as the project name, the size of the initial form, and the target device.
    • Make—provides a title for the App object (a global object that can be used to determine or specify information about the application) and sets version-number information.
  4. Choose the Default button to accept default properties for the project, or enter the appropriate information and choose OK.

The project properties may be changed later by choosing Properties from the Project menu. Once a project has been created, you cannot change the target platform. However, the target device can be changed by modifying the project properties. For example, you can change the target device from Palm-size PC emulation to a Palm-size PC device, but you cannot change the target platform from Palm-size PC to Handheld PC.

With the preliminary project setup completed, the application's initial form will be displayed, and you can create the user interface for the application.

To design a user interface

Developing a user interface for a Palm-size PC application with the toolkit is similar to developing a user interface for a desktop application with Visual Basic 6.0.

  1. Choose an intrinsic or ActiveX control in the toolbox and place it on a form.

    The toolkit will display an alert and remove the control if it cannot be used on a Palm-size PC.

  2. Add or remove controls from the toolbox:

    • Choose Components from the Project menu.
    • Choose the Controls tab from the Components dialog box.
    • Select the controls to add to the toolbox.

    **Note   **All controls applicable to Windows CE-based platforms are prefixed by the phrase Microsoft CE.

  3. Modify properties for the project's forms and controls by choosing the appropriate object and modifying its properties in the Properties window. Choose the Properties window from the View menu if it is not shown.

A Palm-size PC application cannot unload a form, but you can still use multiple forms in an application. If a form is not in use, the Hide method can be called to remove it from the display, or the SetFocus method can be used to bring another form to the foreground. Because of the memory constraints of a Palm-size PC it is best to be conservative in the number of forms an application uses.

Despite the ease with which a user interface may be constructed using Visual Basic, it is still important to consider what makes a good user interface for a Palm-size PC. Form layout should be appropriate for the size and orientation of the Palm-size PC's screen. Avoid using a horizontal layout for forms. Instead, display content vertically to match the orientation of the screen. Conserve screen space by using separator bars instead of frames to group related information. Another method for conserving screen space is to use the most compact control that meets the needs of the application. For example, substitute drop-down list boxes for groupings of radio buttons.

To add code to the application

  • After the controls have been placed on forms for the application, code is added to the project to specify the behavior of the application. Each form has an associated module that contains the code entered for that form and its controls.

To use the code editor window to enter code

  1. On the View menu, choose Code.
  2. From the Object list box, choose the appropriate object.
  3. From the Procedure list box, choose the desired procedure to define.
  4. In the code editor window, enter the necessary code.

Functions and subroutines may be entered in a module (.bas file) separate from the application's forms. The procedure for adding a module is the same as for a desktop project. The names of the functions and subroutines share a global namespace, so they must be unique. Any name conflicts will be identified at compile time. The toolkit does not support class modules (.cls files); however, multiple .bas modules may be used.

Testing the Application

After the application has had its user interface and its behavior defined, it must be tested. Testing and debugging a Palm-size PC application using the toolkit is also similar to the procedure used for desktop applications. You can choose to set breakpoints in the code as well as step into functions and subroutines to examine the operation of the application.

To test the application

  1. To copy the application to the current device and launch the application, choose Start from the Run menu.
  2. To change the device to which to download the application, choose Properties from the Project menu and select the appropriate device in the Run on Target list box.

If you make changes to the application, be sure to exit the running application on the device before downloading a new version.

To debug the application

  • From the Debug menu, choose Step Into or Go.

    This downloads the application to the specified device and opens the Windows CE Toolkit for Visual Basic Debugger window.

The most efficient process to follow for initial testing and debugging of an application for the Palm-size PC is to use emulation. After preliminary testing and debugging is complete, test the application on the target device to ensure proper application function.

**Note   **Breakpoints must be set in the debugger window, not in code editor windows.

Porting Applications to the Palm-size PC

Code reuse is a common goal in software development. Although Windows CE presents an integrated development environment, you should note some issues that might pose challenges in sharing code between the Palm-size PC and other platforms.

It is not possible to change the target of a Visual Basic 6.0 project from one platform to another, so applications must be ported to a new platform. This process typically involves creating a new project targeted for the appropriate platform, and then inserting existing forms and modules into the new project. However, since the toolkit supports a subset of the Visual Basic language, this process contains some obstacles. For example, forms for a desktop project might contain controls that are not supported for a Palm-size PC. A module may also contain a language construct that is not supported in the toolkit.

Typical portability considerations include the following:

  • Porting code from a desktop.

    An application designed for the desktop is not usually appropriate as a portable application. Typically, only a subset of the features of a desktop application is necessary in a portable situation. In this case you can choose the functions of the desktop application that would be useful to a Palm-size PC user and create a portable application. This application can work as a portable companion to the desktop application.

  • Porting code from other mobile devices.

Fewer issues arise when taking a Handheld PC application to the Palm-size PC. An application designed for mobile devices other the Palm-size would typically need its user interface redesigned to meet the display needs of a Palm-size PC. However, the controls and code from the application should be portable.

For More Information

For the most recent information on developing Palm-size PC applications, consult the Windows CE Platform SDK, Palm-size Edition, and the Windows CE Web site at: www.microsoft.com/windows/embedded/.

--------------------------------------------

The information contained in this document represents the current view of Microsoft Corporation on the issues discussed as of the date of publication. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information presented after the date of publication. This document is for informational purposes only.

This White Paper is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS DOCUMENT.

Microsoft, ActiveX, Visual Basic, Visual C++, Windows, and Windows NT are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries.

Other product and company names mentioned herein may be the trademarks of their respective owners.