i currently use 3rd party logger software but it is not very stable. The hex characters received through a serial port are converted into numbers and then transmits these numbers to the app as keystrokes. i.e 0004, or 0005, etc. followed by a comma and "ENTER".
i use the following code in my 3rd party application but it sometimes give me garbage numbers in between.
Expand|Select|Wrap|Line Numbers
- SendKeyStrokes (DATA.replace (/[^0-9]/g, ""));
- SendKeyStrokes (",");
- SendKeyStrokes ("{ENTER}");
The textbox on the main form is called "StrInput"
Is there anybody out there that receive data directly from scanners and it is added to textbox? It must also not be more than 5 characters, split by a "," and only numeric format.Can one perhaps block duplicates mumbers also?
Pls assist
i found this code on the internet if it may assist?
Expand|Select|Wrap|Line Numbers
- Dim intPortID As Integer ' Ex. 1, 2, 3, 4 for COM1 - COM4
- Dim lngStatus As Long
- Dim strError As String
- Dim strData As String
- ' Initialize Communications
- lngStatus = CommOpen(intPortID, "COM" & CStr(intPortID), _
- "baud=9600 parity=N data=8 stop=1")
- If lngStatus <> 0 Then
- ' Handle error.
- lngStatus = CommGetError(strError)
- MsgBox "COM Error: " & strError
- End If
- ' Set modem control lines.
- lngStatus = CommSetLine(intPortID, LINE_RTS, True)
- lngStatus = CommSetLine(intPortID, LINE_DTR, True)
- ' Write data to serial port.
- lngSize = Len(strData)
- lngStatus = CommWrite(intPortID, strData)
- If lngStatus <> lngSize Then
- ' Handle error.
- End If
- ' Read maximum of 64 bytes from serial port.
- lngStatus = CommRead(intPortID, strData, 64)
- If lngStatus > 0 Then
- ' Process data.
- ElseIf lngStatus < 0 Then
- ' Handle error.
- End If
- ' Reset modem control lines.
- lngStatus = CommSetLine(intPortID, LINE_RTS, False)
- lngStatus = CommSetLine(intPortID, LINE_DTR, False)
- ' Close communications.
- Call CommClose(intPortID)