This may Be a daft question but I was hoping someone could advice me on this
I have been thinking about dropping my DOS Support (And A LOT of you will be screaming "about time") and I was thinking about moving onto Linux (Debian or FreeBSD) or windows.
I have been looking at the idea of moving my barcode Reader support into a thread on its own (so it will run no matter what the program is doing)
Code: Select all
Sub PriceCheck_SignedOff
ScannerFucntion = "SignedOff_PriceCheck"
MenuBeingDisplayed = "PriceCheckSignedOff"
ScreenLock
PriceCheckDisplay
DisplaySalescreenMenu(MenuBeingDisplayed)
DisplayFunctionKeyLabels
DisplayTaskBar(1)
ScreenUnLock
Select Case ScannerType
Case "Com", "COM", "com"
Do : DisplayTaskBar(1) : ProcessKey_PriceCheckSignedoff(GetKeyNB) : SelectSerialScanner
Loop
Case"KBW", "kbw"," Kbw", ""
Do : DisplayTaskBar(1) : ProcessKey_PriceCheckSignedoff(GetKeyNB)
Loop
End Select
End Sub
that is my current code to display the price check screen. but at the moment i am having a small issues with keeping the date & time showing correctly. (when running on a windows test machine the clock on the Windows taskbar could say 15:22 but the Time on the PoS program could say 15:19 (and not change unless i restart the software)
so what i was thinking was to move the selectSerialScanner into a tread on its own
Code: Select all
Private Sub SelectSerialScanner
Do While LOC(BarcodeReader) > 0
Buffer = ""
buffer = Input(1,BarcodeReader)
If buffer <> Chr(Val(ScannerPrefix)) Then
dim a as string = buffer
dim result as string
For x as integer = 0 to len(a) -1
If instr(chr(a[x]),any "0123456789" & Chr(Val(ScannerPrefix))) then
result += chr(a[x])
End If
Next x
datareceived += result
End If
'If DebugMode = 1 Then
Open Cons For Output As #DebugConsole
Print #DebugConsole, "Data From Scanner"
Print #DebugConsole, datareceived
Close #DebugConsole
'End If
If buffer = Chr(Val(ScannerPrefix)) Then 'tells NPoS the scanner is done
If RemoveNumber > 0 then
Dim Temp as string = mid$(datareceived, RemoveNumber, len(datareceived))
datareceived = ""
datareceived = Temp
End If
ScannerFucntionSub(datareceived)
datareceived = ""
End If
Loop
End Sub
this is the code that works the scanner (will have to add support for the Scale soon) as you can see when it gets the ScannserPrefix chr (normally the enter chr) the software would then use the ScannerFucntionSub to process the scanned barcode number
Code: Select all
Private Sub ScannerFucntionSub(ByVal BarcodeNumber As String)
datareceived = ""
Buffer = ""
Select Case ScannerFucntion
Case "SaleScreen"
SubTotalPressed = 0
FindProduct(BarcodeNumber)
Case "Salescreen_PriceCheck"
FindProduct_PriceCheck(BarcodeNumber, "SaleScreen")
Case "SignedOff_PriceCheck"
FindProduct_PriceCheck(BarcodeNumber, "SignedOff_PriceCheck")
Case "GiftCard"
End Select
end Sub
The FindProdoct code is independ to the screen etc so would I have to make it accessible to the thread or does the ScannerFucntionSub make the program drop out of the tread and run that code while still running the SelectSerialScanner in a thread?
or have i totally got the wrong end of how threads work.