Beste mensen, jullie willen niet weten hoe lang ik hiernaar opzoek ben geweest.
Er is veel over te vinden, maar voor mij werkte het allemaal niet.
Totdat ik deze link tegen kwam:
http://www.geekhideout.com/iodll.shtml
Download hier io.dll.
Niet ergens anders, want dan zal het niet werken.
Zet io.dll in dezelfde map als je programma (*.exe)
Pleur dit helemaal bovenaan je code (vb2005)
Public Declare Sub PortOut Lib "IO.DLL" (ByVal Port As Integer, ByVal Data As Byte)
Public Declare Sub PortWordOut Lib "IO.DLL" (ByVal Port As Integer, ByVal Data As Integer)
Public Declare Sub PortDWordOut Lib "IO.DLL" (ByVal Port As Integer, ByVal Data As Long)
Public Declare Function PortIn Lib "IO.DLL" (ByVal Port As Integer) As Byte
Public Declare Function PortWordIn Lib "IO.DLL" (ByVal Port As Integer) As Integer
Public Declare Function PortDWordIn Lib "IO.DLL" (ByVal Port As Integer) As Long
Public Declare Sub SetPortBit Lib "IO.DLL" (ByVal Port As Integer, ByVal Bit As Byte)
Public Declare Sub ClrPortBit Lib "IO.DLL" (ByVal Port As Integer, ByVal Bit As Byte)
Public Declare Sub NotPortBit Lib "IO.DLL" (ByVal Port As Integer, ByVal Bit As Byte)
Public Declare Function GetPortBit Lib "IO.DLL" (ByVal Port As Integer, ByVal Bit As Byte) As Boolean
Public Declare Function RightPortShift Lib "IO.DLL" (ByVal Port As Integer, ByVal Val As Boolean) As Boolean
Public Declare Function LeftPortShift Lib "IO.DLL" (ByVal Port As Integer, ByVal Val As Boolean) As Boolean
Public Declare Function IsDriverInstalled Lib "IO.DLL" () As Boolean
En nu kun je bij een button instellen
' Use LPT1
Dim port As Integer = &H378
' Some data to write - valid 0-255
Dim data As Byte = &H55
PortOut(port, data)
Je ziet hier &H55 staan. 55 is het hexadecimale getal waarmee je de poort kunt aansturen. Die &H moet er gewoon voor staan.
De code om te lezen kan ik even niet vinden maar die zal ik binnenkort wel even posten.