Symbol 開發初體驗(2)

今天安裝了 vs2003 Profession English 版本,並在其中重新編寫了“HelloScan”程序。但存在“无法将程序发布到symbol mc1000 问题”,其中參數為:ActiveSync4.5 中文版、Symbol 開發包 Smdk1.07版、vc#程序中 Deployment Device=”Windows CE .Net Device”。后查詢資料發現需作如下變動:
1、建立连接的时候选择guest,也就是不要与pc同步
2、建立wince的windows应用程序,进行部署的时候先选ppc设备(这个是必须的,经测试,先选ce就不行,但先选ppc再选ce没问题)

另1:之前提到“因爲在虛擬器中,所以沒有掃描設備,故涉及到MyReader要註釋掉(如:MyReader = new Symbol.Barcode.Reader();),否則會提示“NullReferenceException 试图在代码中引用不存在的对象时””,因爲本次是在真正設備上運行,故沒有註釋 MyReader 語句。也運行正常。
另2:因手頭還有台 Intermec Scan Device,用以下程序 Deploy 到該設備,正常,但 Scan 時無法彈出 Barcode,推測結論為:Symbol的SDK 無法用在其它品牌的Code上

附 HelloScan 源程序:
using System;
using System.Drawing;
using System.Collections;
using System.Windows.Forms;
using System.Data;

namespace Mc1000_test01
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private Symbol.Barcode.Reader MyReader = null;
private Symbol.Barcode.ReaderData MyReaderData = null;

public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();

//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
//
// Form1
//
this.Text = "Form1";
this.Closing += new System.ComponentModel.CancelEventHandler(this.Form1_Closing);
this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.Form1_KeyPress);
this.Load += new System.EventHandler(this.Form1_Load);

}
#endregion

/// <summary>
/// The main entry point for the application.
/// </summary>

static void Main()
{
Application.Run(new Form1());
}

private void Form1_Load(object sender, System.EventArgs e)
{
//System.Windows.Forms.MessageBox.Show("xxxxxx", "HelloScan");

MyReader = new Symbol.Barcode.Reader();
MyReaderData =
new Symbol.Barcode.ReaderData(Symbol.Barcode.ReaderDataTypes.Text,
Symbol.Barcode.ReaderDataLengths.DefaultText);
MyReader.ReadNotify += new EventHandler(MyReader_ReadNotify);
MyReader.Actions.Enable();
MyReader.Actions.Read (MyReaderData);
return;
}

private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
MyReader.Actions.Flush();
MyReader.Actions.Disable();
MyReader.Dispose();
MyReaderData.Dispose();
return;
}
private void MyReader_ReadNotify(object sender, EventArgs e)
{
//System.Windows.Forms.MessageBox.Show("yyyyyy", "HelloScan");
System.Windows.Forms.MessageBox.Show(MyReaderData.Text, "HelloScan");
MyReader.Actions.Read(MyReaderData);
return;
}

private void Form1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
if (e.KeyChar==(char)13)
{
MyReader.Actions.Flush();
MyReader.Actions.Disable();
MyReader.Dispose();
MyReaderData.Dispose();
this.Close();
}
}
}
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值