Motorola Scanner SDK BarcodeEvent Trigger

Any help with this is greatly appreciated -

I am having trouble firing BarcodeEvent in VB.NET. The scanner is in USB mode (manual manual mode) and everything works fine with the C # sample app that came with the SDK. Also, I can make a Beep scanner in VB.net, so the driver works fine. I probably messed up converting this C # code to VB

cCoreScannerClass.BarcodeEvent += new
_ICoreScannerEvents_BarcodeEventEventHandler(OnBarcodeEvent);

void OnBarcodeEvent(short eventType, ref string pscanData)
{
    string barcode = pscanData;
    this.Invoke((MethodInvoker)delegate { textBox1.Text = barcode; });
}

      

- Here is my code: -------

Imports CoreScanner
Imports System.Collections.Generic
Imports System.Text

Public Class Form1

    Public WithEvents cCoreScannerClass As CCoreScannerClass

    Sub Main()

        cCoreScannerClass = New CCoreScannerClass
        Dim scannertype(1) As Short
        scannertype(0) = 1
        Dim numberOfScannerTypes As Short
        numberOfScannerTypes = 1
        Dim status As Integer

        cCoreScannerClass.Open(0, scannertype, numberOfScannerTypes, status)

        AddHandler cCoreScannerClass.BarcodeEvent, AddressOf OnBarcodeEvent

        Dim opcode As Integer = 1001
        Dim outXML As String 
        Dim inXML = "<inArgs>" +
                       "<cmdArgs>" +
                           "<arg-int>1</arg-int>" +
                           "<arg-int>1</arg-int>" +
                       "</cmdArgs>" +
                    "</inArgs>"

        cCoreScannerClass.ExecCommand(opcode, inXML, outXML, status)

    End Sub

    Public Sub OnBarcodeEvent(eventType As Short, ByRef pscanData As String) Handles cCoreScannerClass.BarcodeEvent
        MsgBox("Success!")
    End Sub

      

+3


source to share


2 answers


After playing with all the events, this exact exact VB.net code started working all of a sudden. I think the scanner came to its senses when I did a reboot. There is no VB.net example for the corescanner class for Motorola, sooo. Welcome:)



+1


source


I had an identical problem and it was ultimately determined to be related to the permissions of the Interop.CoreScanner.dll file.

A simple "Build" demo application will work on a clean installation. Clearing and rebuilding may cause events to fail, but other calls (such as detecting scanners or sounding a beeper) will work. My custom app behaved the same as the cleaned and repaired demo app.

It turns out the SDK ships demo apps with pre-built binaries that have different permissions than the installer:

  • Prebuilt binary Motorola Scanner\Scanner SDK\Scanner SDK\Sample Applications\bin

           Group: System Administrators Users
Permission:                
 - Full Control XX             
 - Modify XX             
 - Read and Execute XXX
 - Read XXX
 - Write XX            
 - Special Permissions


  • Copying a library to Motorola Scanner\Common

           Group: System Administrators BUILTIN (BUILTIN)?
Permission:                
 - Full Control XXX
 - Modify XXX
 - Read and Execute XXX
 - Read XXX
 - Write XXX
 - Special Permissions

I have no idea who the BUILTIN user is, or why the user group doesn't have permissions, or why you might be able to execute some but not all of the code in a DLL with the latest setup.

However, by replacing the latter with the first one, I solved my problem.

+1


source







All Articles