zoukankan      html  css  js  c++  java
  • 使用Visual Studio 2008创建你的第一个Windows Mobile程序介绍

    介绍

      Microsoft Visual Studio 2008 专业版或者更高版本提供了一个Windows Mobile程序开发环境,允许你使用本地代码(C / C++)或托管代码(C# / Visual Basic.NET)为Windows Mobile设备创建程序。

      这篇文章将带你正确的安装Visual Studio 2008和附加的Windows Mobile SDK,接着我们将创建第一个Windows Mobile程序,该程序的目标设备是Windows Mobile 6。同时还将介绍使用设备模拟器帮助你测试Windows Mobile程序,而不需要我们一定拥有Windows Mobile 设备。

    安装Visual Studio 2008和附加Windows Mobile SDK

      我们假定你已经拥有了一台想用来开发Windows Mobile程序的计算机,首先我们来安装Visual Studio 2008和MSDN,如果你没有Visual Studio 2008,你可以在微软的网站上下载一个评估版的 Microsoft Visual Studio 2008 Professional,下载地址为:http://msdn.microsoft.com/en-us/vstudio/products/aa700831.aspx,如果您使用的是.iso版本,请先安装虚拟光驱,把iso加载到虚拟光驱中即可,如果你购买的是DVD光盘,请放入DVD光驱,你将会看到安装向导,一切按照默认设置,您将顺利地安装Visual Studio 2008和MSDN。

      接下来我们需要去安装Visual Studio 2008的最新更新,目前的更新包是: Visual Studio 2008 Service Pack 1 ,下载地址为:http://www.microsoft.com/downloads/details.aspx?FamilyId=FBEE1648-7106-44A7-9649-6D9F6D58056E&displaylang=en,请下载后安装,由于文件较大,可能会花费一些时间。

      到此为止,你已经成功安装了Visual Studio 2008,可以用它来开发ASP.NET、WinForm和智能设备程序(仅能开发Windows Mobile 5.0以前的程序),如果需要开发Windows Mobile 6设备上的程序,还需要安装Windows Mobile 6 SDK和Windows Mobile 6 模拟器,下面是下载地址:

      Windows Mobile 6 Professional and Standard Software Development Kits Refresh:
    http://www.microsoft.com/downloads/details.aspx?FamilyID=06111A3A-A651-4745-88EF-3D48091A390B&displaylang=en
    注: Windows Mobile 6 Professional SDK Refresh.msi  用于开发使用触屏的Windows Mobile程序。
    Windows Mobile 6 Standard SDK Refresh.msi  用于开发使用键盘的Windows Mobile程序。

      Windows Mobile 6 Localized Emulator Images
    http://www.microsoft.com/DOWNLOADS/details.aspx?FamilyID=38c46aa8-1dd7-426f-a913-4f370a65a582&displaylang=en

      下面是Windows Mobile 6.1的模拟器,感兴趣可以从以下链接下载:
      Windows Mobile 6.1.4 Emulator Images
    http://www.microsoft.com/downloads/details.aspx?FamilyID=1A7A6B52-F89E-4354-84CE-5D19C204498A&displaylang=en#Overview
    注:Windows Mobile 6.1.4 Professional Images (USA).msi 模拟使用触屏的Windows Mobile 6.1系统。
    Windows Mobile 6.1.4 Standard Images (USA).msi 模拟使用键盘的Windows Mobile 6.1系统。

      在此文章发表之时Windows Mobile 6.5的模拟器已经发布,如果你感兴趣,可以到以下地址下载:
      Windows Mobile 6.5 Developer Tool Kit
    http://www.microsoft.com/downloads/details.aspx?FamilyID=20686A1D-97A8-4F80-BC6A-AE010E085A6E&displaylang=en

      以上程序下载完成后,请先安装Windows Mobile SDK,再安装模拟器,安装过程中按照提示进行安装,就可以顺利安装,到这里我们的准备工就完成了。


    创建你的第一Windows Mobile 程序

      创建一个新的智能设备项目
    1、打开Microsoft Visual Studio 2008。
    2、在文件菜单,点击新建,选择项目。
    3、在项目类型,选择Visual C# ,选择智能设备。
    4、指定一个新的名称HelloMobile、位置和解决方案名HelloMobile,点击确定。


    9、把Form1的属性Text修改为“Hello Mobile”,MinimizeBox属性修改为false。
    10、从工具箱中向Form1拖入一个Button在属性栏里把Name修改为“btnHello”,把Text修改为“Hello”。
    11、从工具箱中向Form1拖入一个Lable 在属性栏里把Name修改为“lblInfo”,把Text修改为空。
    12、双击btnHello,书写以下代码:
            private void btnHello_Click(object sender, EventArgs e)
            {
                lblInfo.Text = "Hello Mobile"
                    + ",click at:"
                    + DateTime.Now.ToLongTimeString();
            }

    编译并发布你的程序

    13、在目标设备列表中选择Windows Mobile 6 Professional Emulator,在生成菜单,选择生成解决方案。
    14、在调试菜单选择启动调试,选择Windows Mobile 6 Professional Emulator,点击部署,Visual Studio 2008将帮助把我们的程序部署到模拟器上,部署完成后程序将在模拟器中打开。

    测试你的程序

    15、点击Hello按钮,检查lblInfo控件上是否显示预定规则的文字。


    16、点击OK将关闭应用程序。
    17、关闭模拟器,在文件菜单中选择保存状态并退出。
    18、在Visual Studio 2008中停止调试,关闭HelloMobile解决方案。
    19、关闭Visual Studio 2008。


    5、在目标平台上选择 Windows Mobile 6 Professional SDK。
    6、在.Net Compact Framework 版本列表选择.Net Compact Framework version 3.5。
    7、在模板中选择设备应用程序。


    8、点击确定 Visual Studio 2008将帮助我们创建一个HelloMobile的设备应用程序,并生成一个默认窗体Form1,如下图:

  • 相关阅读:
    设置ActiveMQ的访问密码
    Java NIO SocketChannel套接字通道
    Java 8 基础API的一些小的该进
    Java 8 异常该进
    Java NIO Channel to Channel Transfers通道传输接口
    Java NIO Scatter / Gather
    mysql分表经验总结
    Java 8 Optional类深度解析(转)
    Java 8 文件操作(转)
    使用 Java8 Optional 的正确姿势(转)
  • 原文地址:https://www.cnblogs.com/qingchen1984/p/4432226.html
Copyright © 2011-2022 走看看