Creating Pocket PC Apps with The Smart Device Extensions

zhaozj2021-02-16  96

Author: James Foster

Microsoft has recently announced the beta of the .NET Compact Framework, which is designed for the Pocket PC platform, as well as the Smart Device Extensions, an add-on to Visual Studio.NET to simplify the development of Pocket PC applications. You do not need to own a Pocket PC PDA to develop applications as the Smart Device Extensions contains an emulator for you to test out your applications. This article walks you through the development of a simple Pocket PC application, getting you started on the road to being a Pocket PC Developer.

The Smart Device Extensions Can Be Obtaind Here:

Http://msdn.microsoft.com/vstudio/device/smartdev.asp

(C: if Your

.NET Framework Version IS 1.1 or Above, You Can Pass this step.

CREATING a project

The Smart Device Extensions integrate directly into the Visual Studio IDE Once installed, they add a new project type for C # and VB.NET applications:.. The Smart Device Application This is shown in the following screenshot:

This starts the Smart Device Application Wizard. You have the choose of targeting Windows CE .NET devices, or Pocket PCs. You also have the option of creating a WinForms application, a Class Library (assembly), or a Control Library. We'll Opt to Target The Pocket PC, and Create A Windows Application.

We then click finish, and Visual Studio will have a Windows Form ready for us. This is very similar to a regular Windows Form, with the differences being a smaller Controls library to choose from, the "Device Controls", as well as the smaller Form size. Pocket PCS Typically Use a 240x320 resolution.

As is typical in software development, the first application you write usually prints out "Hello World". Our application will feature a textbox and a button. The user can enter in their name, and clicking the button will show a messagebox greeting them by name .First, drag a label, textbox, and button onto the form from the Device Controls toolbar. Rename the textbox to txtName, and the button to btnSubmit. Double-click the submit button. This will generate a skeleton wrapper for the click event. ENTER in The Following Line of Code:

Messagebox

.Show

(

"Hi"

TXTNAME

.Text

);

Messagebox

.

Show

(

"Hi"

&

TXTNAME

.

TEXT

)

C # VB

.

Testing in the emulator

Now that we have our simple application, let's move onto testing it. From the Build menu, select Build Solution (or press ctrl alt B). You should have no compile errors. Next, on the Debug menu, select Start (or press the "Play" toolbar icon). This will bring up the Deployment dialog. you can deploy and test your application on a real Pocket PC attached to your computer, or you can use the emulator. We'll select the Pocket PC Emulator and click Deploy. If this is your first application, the emulator will load the .NET runtime into it's image. The Emulator will load the Today screen, and then Visual Studio will continue to load your application. You can follow the progress of the load in Visual Studio's status bar. Eventually, the application will load in the emulator. Enter your name in the textbox, and click the button. You should get a messagebox greeting your by name, as shown in the screenshot below.

转载请注明原文地址:https://www.9cbs.com/read-13536.html

New Post(0)