手机编程

硬件多普达565的智能手机,加上了128M的MiniSD卡,基本可以满足编程的需求了,便随手写了一个最简单的HelloWord,并到手机上调试(部署到菜单中暂时没有实现)。

一、基本配置
PC环境:Windows XP SP2,VS.NET 2003 企业版,.NET Framework 1.1 SP1
SmartPhone环境:Microsoft SmartPhone 2003 SE 第二版(含.NET1.1,部署的时候会被强行装上
.NET Framework 1.1 SP1)
ASYNC:Microsoft ActiveSync 3.7.1

二、SDK的安装
必须安装的软件(如下软件都是微软提供免费下载和使用的)
1、Microsoft ActiveSync 3.7.1
(最新版本Microsoft ActiveSync 3.8出来了,可以到摘要的页面中去找链接下载,这个我还没有试过)
下载网址:http://www.microsoft.com/windowsmobile/downloads/activesync37.mspx,里面有中文版本,或者,在手机附带的微软光盘里面有安装程序;

作用:同步手机和PC机数据的程序

2、Microsoft SMARTPHONE 2003 SDK.msi
下载网址: http://www.hao400.org.cn
http://download.microsoft.com/download/e/3/1/e310bb99-2f33-4d79-bb8a-41d9cb3c79b4/Microsoft
SMARTPHONE 2003 SDK.msi
这个是开发Microsoft SMARTPHONE 2003第二版 应用程序 所需要使用的SDK包

Overview
The Smartphone 2003 SDK enables application development for the
newest Smartphone development platform. The Smartphone 2003 SDK
enables developers to:

Develop .NET applications for devices: The Microsoft® .NET Compact
Framework is in ROM in Windows Mobile 2003-based Smartphones and
enables a whole new host of benefits for developers, such as rapid
application development, native XML Web services support,
enterprise class connectivity and performance, and IDE support from
Microsoft Visual Studio® .NET 2003.

Leverage new core Operating System: Windows Mobile 2003-based
Smartphones, like 2003-based Pocket PCs, run on Windows CE .NET
4.2, enhancing APIs and overall programmability.

Develop, test and deploy applications faster: The emulation
environment is more robust and now supports Windows Mobile
2003-based Smartphones with support for radio. The emulator also
offers new features, including drive mapping, GAPI support and
performance improvements. In addition, the new application security
model includes a “prompt” mode.
3、MobileAppDevToolkit2004.exe
下载地址:http://www.tel400.org.cn
http://download.microsoft.com/download/b/2/5/b25742c0-daa3-4a8c-988d-a947a35e0a68/MobileAppDevToolkit2004.exe

Overview
The Mobile Application Development Toolkit provides all the
resources you need to start building mobile applications for
Smartphone and Pocket PC devices.

The kit includes:
Windows Mobile Development Guided Tour
QuickStarts
Hands-on Labs
Technical Articles
Business Success Stories
Information about Developer Tools and SDKs
Software and Special Offers
System Requirements
Supported Operating Systems: Windows 2000, Windows 2000
Professional Edition , Windows 2000 Service Pack 2, Windows 2000
Service Pack 3, Windows 2000 Service Pack 4, Windows XP, Windows XP
Professional Edition , Windows XP Service Pack 1, Windows XP
Service Pack 2

作用:这个是用来安装模拟器的,如果没有手机调试,可以在模拟器上调试

三、写一个Hello World

所有以上程序http://www.voip5.org.cn安装好以后,就可以开始编写在智能上运行的程序了。
1、打开VS.NET2003,然后新建项目,选择“智能设备应用程序”:

2、选择“SmartPhone”-“Windows应用程序”

3、在面板上托放一个PictureBox和一个Label

呵呵,这可以说是一个最最简单的HelloWorld程序吧:)

4、F5运行,会出现如下对话框

如果没有手机的话,就选择第二个默认,我今天刚买的新机,所以就选了
“Smartphone Device”了:D

5、点击“部署”,我的手机上便会提示“此程序不被信任,是否继续执行?”,选择“继续”,如果是第一次运行,会更新 .NET
Framework Compact ,保持和PC机器版本一致(.NET Framework
SP1,我的机器上出现如下提示:“警告:在安装Microsoft .NET CF 1.0 ENU-String Resource
的新版本http://www.chong123.cn之前,其以前的版本将被删除。”),部署需要几分钟时间,要有耐心等候。

部署成功后,过10秒钟左右,手机屏幕上就会显示最终的程序运行状况了,呵呵,很简单吧:)
当然,还只是初步的尝试一下,而且中间省略了一些手机上显示的信息(少了一个数码相机:) ),如果有了很多编写Windows
应用程序的经验,相信你会马上开始编写复杂实用的程序来的。

Tagged as: ,