Buenas.
Esta es la manera de llamar a la IO.dll, el código lo he sacado de un ejemplo que hice hace tiempo, si quieres el código fuente hazmelo saber y te lo enviaré.
Referente de como puedes encontrar el I2004 no tengo ni idea en mi trabajo lo pedimos a los grandes distribuidores y ellos nos lo proporcionan pero mi imagino que en cualquier tienda de electrónica lo puedes encontrar.
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
Dim sOrt As Byte 'valor de la salida puerto paralelo
Dim sIn As Byte 'valor de la entrada puerto paralelo
Dim pOut As Integer 'direccion del puerto paralelo
Dim pIn As Integer 'direccion del puerto paralelo
Private Sub Form_Load()
If IsDriverInstalled = True Then
pOut = &H378 'puerto LPT1 (salida datos)
pIn = &H379 'puerto LPT1 (Status )
sOrt = 0 'desactivo todas las salidas
PortOut pOut, sOrt lo saco por el puerto
sIn = PortIn(pIn) 'obtengo el valor del puerto paralelo
Else
MsgBox "El Driver no se encuentra cargado en memoria ", vbCritical + vbOKOnly, "Error"
Unload Me
End If
End Sub
Esta es la manera de llamar a la IO.dll, el código lo he sacado de un ejemplo que hice hace tiempo, si quieres el código fuente hazmelo saber y te lo enviaré.
Referente de como puedes encontrar el I2004 no tengo ni idea en mi trabajo lo pedimos a los grandes distribuidores y ellos nos lo proporcionan pero mi imagino que en cualquier tienda de electrónica lo puedes encontrar.
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
Dim sOrt As Byte 'valor de la salida puerto paralelo
Dim sIn As Byte 'valor de la entrada puerto paralelo
Dim pOut As Integer 'direccion del puerto paralelo
Dim pIn As Integer 'direccion del puerto paralelo
Private Sub Form_Load()
If IsDriverInstalled = True Then
pOut = &H378 'puerto LPT1 (salida datos)
pIn = &H379 'puerto LPT1 (Status )
sOrt = 0 'desactivo todas las salidas
PortOut pOut, sOrt lo saco por el puerto
sIn = PortIn(pIn) 'obtengo el valor del puerto paralelo
Else
MsgBox "El Driver no se encuentra cargado en memoria ", vbCritical + vbOKOnly, "Error"
Unload Me
End If
End Sub