Visual Basic - Comprobar estado impresora matriz de puntos W2000

Life is soft - evento anual de software empresarial
 
Vista:

Comprobar estado impresora matriz de puntos W2000

Publicado por Pablo (2 intervenciones) el 02/12/2005 17:36:56
Tengo el sgte problema:

Hago una verificación del estado del puerto LPT1 antes de enviar datos a imprimir. Lo hago de la sgte manera:

Declaraciones:

Public Const GENERIC_WRITE = &H40000000
Public Const GENERIC_READ = &H80000000
Public Const FILE_ATTRIBUTE_NORMAL = &H80
Public Const CREATE_ALWAYS = 2
Public Const OPEN_ALWAYS = 4
Public Const INVALID_HANDLE_VALUE = -1

Public Type COMSTAT
Filler1 As Long
Filler2 As Long
Filler3 As Long
Filler4 As Long
Filler5 As Long
Filler6 As Long
Filler7 As Long
Filler8 As Long
Filler9 As Long
Filler10 As Long
End Type

Declare Function CreateFile Lib "kernel32" _
Alias "CreateFileA" (ByVal lpFileName As String, _
ByVal dwDesiredAccess As Long, ByVal dwShareMode As Long, _
ByVal lpSecurityAttributes As Long, _
ByVal dwCreationDisposition As Long, _
ByVal dwFlagsAndAttributes As Long, ByVal hTemplateFile As Long) _
As Long

Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long

Declare Function ClearCommError Lib "kernel32" (ByVal hFile As Long, lpErrors As Long, lpStat As COMSTAT) As Long

Public Const CE_BREAK = &H10 ' break condition
Public Const CE_PTO = &H200 ' printer timeout
Public Const CE_IOE = &H400 ' printer I/O error
Public Const CE_DNS = &H800 ' device not selected
Public Const CE_OOP = &H1000 ' out of paper

Llamada en el programa:

Dim mHandle As Long

mHandle = CreateFile("LPT1", GENERIC_WRITE Or GENERIC_READ, _
0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0)

El problema es que, bajo W98 funciona perfectamente, pero NO funciona bajo W2000. La llamada a CreateFile devuelve un error ERROR_INVALID_PARAMETER.

Si alguien puede ayudar, lo agradecería.

Saludos.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder