摩托罗拉手持MC55A开发[关闭]

问题描述 投票:0回答:2

我有摩托罗拉手持MC55A与Windows嵌入式手持6.5我想开始开发一个应用程序来读取条形码。我没有找到任何参考做我的命令我已经安装VS2008并开始用简单的形式创建智能设备应用程序

windows-ce motorola windows-embedded
2个回答
0
投票

值得称赞的优点:最初我没有写下面的代码,我不确定最初是谁做的,可能是由符号开发人员编写的...我不确定,我只是用过它。

1-首先下载并安装Motorola EMDK,之后,您将复制C:\ Program Files(x86)\ Motorola EMDK for .NET \ v2.5 \ SDK \ Smart Devices \ Symbol.Barcode.dll文件到\我的设备\ Windows文件夹放在口袋里。

Public Class frmTest
Dim MyReader As Symbol.Barcode.Reader = Nothing
Dim MyReaderData As Symbol.Barcode.ReaderData = Nothing
Dim MyEventHandler As System.EventHandler = Nothing
Dim MyHandlerCB As System.EventHandler = Nothing

Private Sub frmTest_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
    InitReader()
End Sub

Protected Overloads Overrides Sub OnClosing(ByVal e As System.ComponentModel.CancelEventArgs)
    StopRead()
    Me.TermReader()
    MyBase.OnClosing(e)
End Sub

Private Function InitReader() As Boolean
    ' If reader is already present then fail initialize
    If Not (Me.MyReader Is Nothing) Then
        Return False
    End If
    'Create new reader, first available reader will be used.
    Me.MyReader = New Symbol.Barcode.Reader
    'Create reader data
    Me.MyReaderData = New Symbol.Barcode.ReaderData( _
                                 Symbol.Barcode.ReaderDataTypes.Text, _
                                 Symbol.Barcode.ReaderDataLengths.DefaultText)
    ' create event handler delegate
    Me.MyEventHandler = New System.EventHandler(AddressOf MyReader_ReadNotify)
    'Enable reader, with wait cursor
    Me.MyReader.Actions.Enable()
    Return True
End Function

Private Sub TermReader()
    'If we have a reader
    If Not (Me.MyReader Is Nothing) Then
        'Disable reader, with wait cursor
        Me.MyReader.Actions.Disable()
        'free it up
        Me.MyReader.Dispose()
        ' Indicate we no longer have one
        Me.MyReader = Nothing
    End If
    ' If we have a reader data
    If Not (Me.MyReaderData Is Nothing) Then
        'Free it up
        Me.MyReaderData.Dispose()
        'Indicate we no longer have one
        Me.MyReaderData = Nothing
    End If
End Sub

Private Sub StartRead()
    'If we have both a reader and a reader data
    If Not ((Me.MyReader Is Nothing) And (Me.MyReaderData Is Nothing)) Then
        'Submit a read
        AddHandler MyReader.ReadNotify, Me.MyEventHandler
        Me.MyReader.Actions.Read(Me.MyReaderData)
    End If
End Sub

Private Sub StopRead()
    'If we have a reader
    If Not (Me.MyReader Is Nothing) Then
        'Flush (Cancel all pending reads)
        RemoveHandler MyReader.ReadNotify, Me.MyEventHandler
        Me.MyReader.Actions.Flush()
    End If
End Sub

Private Sub MyReader_ReadNotify(ByVal o As Object, ByVal e As EventArgs)
    Dim TheReaderData As Symbol.Barcode.ReaderData = Me.MyReader.GetNextReaderData()
    'If it is a successful read (as opposed to a failed one)
    If (TheReaderData.Result = Symbol.Results.SUCCESS) Then
        'Handle the data from this read
        Me.HandleData(TheReaderData)
        'Start the next read
        Me.StartRead()
    End If
End Sub

Private Sub HandleData(ByVal TheReaderData As Symbol.Barcode.ReaderData)
    txtBarCode.Text = TheReaderData.Text
End Sub

Private Sub txtBarCode_GotFocus(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtBarCode.GotFocus
    StartRead()
End Sub

Private Sub txtBarCode_LostFocus(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtBarCode.LostFocus
    StopRead()
End Sub

结束班


0
投票

您想扫描条形码并将其插入应用程序的文本框中吗?尝试从控制面板启用Data Wedge。

© www.soinside.com 2019 - 2024. All rights reserved.