
barcode scanner in USB port
I am somewhat new to VB.Net, and am searching for a way to communicate with
the USB port that has a simple barcode scanner attached. The company
(Symbol) has a demo version software that works well (written in C++) but it
doesnt save the data, so I was hoping to write a routine in VB that I could
use in an inventory program. However, I can't even get the program to
recognize the port(s) on the pc. I would be eternally grateful for any
pointers on how to solve this problem. Here is the routine in C - and my
routine in VB:
C++:
{
ret=csp2Init(port);
if (ret==STATUS_OK) {
ComStarted=true;
//write to screen
Quote:
}
else {
ComStarted=false;
//another msg to screen
}
Quote:
}
VB:
Declare Function csp2Init Lib "csp2.DLL" (ByVal nComPort As Long) As Long
Public Sub cmdOpen1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdOpen1.Click
Dim port As Byte = 1
Dim ComStarted As Boolean
Dim ret As Long
ret = csp2Init(port)
If ret = STATUS_OK Then
ComStarted = True
txtScannerPolling1.Text = portsel & " Opened"
Else
ComStarted = False
txtScannerPolling1.Text = txtScannerPolling1.Text & portsel & "
Failed"
End If
End Sub
I always get a value of "9222812402616107008" in the ret variable.
I guess my big question is: How can I test that the dll is working?