Hi,
I have a vb.net application created in VS 2013 professional - It utilises a symbol LS2208 Barcode scanner.
The application builds and works great on the development machine (thanks to help from Sean Liming - and his book), also the application can be published/deployed and installed on the development machine and works well - the problem is running it on another
machine
I have used Microsoft.pointofservice 1.12.0.0 as well as the manufacturers OPOS Driver for symbol Scanners v3.31 - and installed them on both machines (not sure if this was necessary)
The TestApp within POS.net works on the development machine - The scanner is recognised as STI_USBSCANNER, but does not seem to work on the target computer giving the error below
System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {027D61A3-4251-11D0-B7A4-80BBFFC00000} failed due to the following error: 80040154.
If I cut out the Scanner stuff from the application, it deploys fine
Some insight was gained from regarding x64 and x86 issues
http://social.msdn.microsoft.com/Forums/zh-TW/0a8cb873-dcf5-49ba-a402-f80e0355ea98/unable-to-open-scanner
The development machine is Windows 7 (x64) the target computer is running Windows 8 (x64)
Any help would be gratefully received
Code...
Imports Microsoft.PointOfService Imports System.Collections Imports System.Text 'Imports System 'Imports System.ComponentModel 'Imports System.Threading 'Imports System.IO.Ports 'Imports System.Net.Mail Imports System.Data Imports System.Data.SqlClient Imports System.Configuration Imports System.Configuration.ConfigurationSettings Public Class Form1 Dim sampleNo As Integer = 0 Dim AddedDplus As System.DateTime Dim ts As TimeSpan Dim Day As Integer Dim Dplus As Integer Dim ButtonString As String = "" Dim tare As Decimal = 0 Dim lblWeight As Decimal = 0 WithEvents myExplorer As PosExplorer WithEvents myScanner As Scanner Dim myPort As Array 'COM Ports detected on the system will be stored here Delegate Sub SetTextCallback(ByVal [Wt] As String) 'Added to prevent threading errors during receiveing of data Dim product As String 'Dim grdWeight As Decimal 'Dim tare As Decimal = 0 'Dim lblWeight As Decimal = 0 Public Sub New() ' This call is required by the designer. InitializeComponent() ' Add any initialization after the InitializeComponent() call. myExplorer = New PosExplorer(Me) Dim scannerList = myExplorer.GetDevices(DeviceType.Scanner) For Each item In scannerList 'LstItems.Items.Add(item.ServiceObjectName) If item.ServiceObjectName = "STI_USBSCANNER" Then myScanner = myExplorer.CreateInstance(item) myScanner.Open() myScanner.Claim(1000) myScanner.DeviceEnabled = True myScanner.DataEventEnabled = True myScanner.DecodeData = True End If Next End Sub Private Sub myExplorer_DeviceAddedEvent(sender As Object, e As Microsoft.PointOfService.DeviceChangedEventArgs) Handles myExplorer.DeviceAddedEvent If (e.Device.Type = "Scanner") Then myScanner = myExplorer.CreateInstance(e.Device) myScanner.Open() myScanner.Claim(1000) myScanner.DeviceEnabled = True myScanner.DataEventEnabled = True myScanner.DecodeData = True 'LstItems.Items.Add("Scanner Attached") End If End Sub Private Sub myExplorer_DeviceRemovedEvent(sender As Object, e As Microsoft.PointOfService.DeviceChangedEventArgs) Handles myExplorer.DeviceRemovedEvent If (e.Device.Type = "Scanner") Then myScanner.DataEventEnabled = False myScanner.DeviceEnabled = False myScanner.Release() myScanner.Close() 'LstItems.Items.Add("Scanner Removed") End If End Sub Private Sub myScanner_DataEvent(sender As Object, e As Microsoft.PointOfService.DataEventArgs) Handles myScanner.DataEvent Dim myEncoding As New ASCIIEncoding TextBoxBarcode.Text = Nothing TextBoxBarcode.Text = myEncoding.GetString(myScanner.ScanDataLabel) myScanner.Claim(1000) myScanner.DataEventEnabled = True 'CheckBox if the barcode already exists Dim MyConnection As New SqlConnection MyConnection.ConnectionString = ConfigurationManager.ConnectionStrings("ShelfLifeSaverConnectionString").ConnectionString