Option Strict Off
Option Explicit On
Imports System.Runtime.InteropServices
Imports System.IO.Ports, System.Threading
Imports VB = Microsoft.VisualBasic
Imports System.Text
Module InpOut32_Declarations
'Inp and Out declarations for port I/O using inpout32.dll.
Public Declare Function Inp Lib "inpout32.dll" Alias "Inp32" (ByVal PortAddress As Short) As Short
Public Declare Sub Out Lib "inpout32.dll" Alias "Out32" (ByVal PortAddress As Short, ByVal Value As Short)
End Module
Public Class vbPoort
Public Sub receive()
While True
If txtBarcode.Text.Length = 8 Then
MsgBox(Me.txtBarcode.Text.Length().ToString)
'Te zoeken bestand opzoeken
lpSectionName = "Namen"
MsgBox(lpSectionName)
lpKeyName = txtBarcode.Text
MsgBox(lpKeyName)
lpReturnedString = New String(Chr(0), 255)
'MsgBox(lpReturnedString)
nSize = lpReturnedString.Length
'MsgBox(nSize)
nSize = GetPrivateProfileString(lpSectionName, lpKeyName, "NO ", lpReturnedString, nSize, lpFilename)
lpReturnedString = lpReturnedString.Substring(0, nSize)
'MsgBox(lpReturnedString)
SaveTextToFile(txtBarcode.Text & vbTab & DateTime.Today.ToString, My.Application.Info.DirectoryPath & "\Log.ini")
End If
End While
End Sub
Private Sub vbPoort_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
lblPoort.BackColor = Color.Lime
' This call is required by the Windows Form Designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
lblPoort.BackColor = Color.Lime
'Bron definiëren waar het instellingen bestand staat.
lpFilename = My.Application.Info.DirectoryPath & "\Instellingen.ini"
Dim newThread As New Thread(AddressOf Me.receive)
newThread.IsBackground = True
newThread.Start()
End Sub
End Class
|