Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

¿ Impresora en Online ?

7 views
Skip to first unread message

Cesar Marin Munuera

unread,
Jun 13, 2002, 12:21:36 PM6/13/02
to
Necesito saber en que estado se encuentra la Impresoritaaa, es decir con
saber si esta en Online o no me valdria.
utilizo el objeto Printer y ya he estado viendo codigo por ahi pero nada ,
no doy con la tela...

Agradecido Eternamente.

Salu2 al grupo.


Ejemplo esto no junciona.


Private Sub Command1_Click()
Dim mHandle As Long
Dim lpErrors As Long
Dim x As COMSTAT

mHandle = CreateFile("lpt1", GENERIC_WRITE Or GENERIC_READ, _
0, 0, 1, FILE_ATTRIBUTE_NORMAL, 0)


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

If mHandle < 0 Then
MsgBox "error de apertura del puerto " & mHandle
Else

If ClearCommError(mHandle, lpErrors, x) = False Then
MsgBox "Error en ClearCommError"
End If
End If

If lpErrors And CE_BREAK Then

MsgBox "Error genérico"
End If

If lpErrors And CE_PTO Then

MsgBox "Timeout de impresora"
End If

If lpErrors And CE_IOE Then

MsgBox "Error de entrada/salida"
End If

If lpErrors And CE_DNS Then
MsgBox "Dispositivo no seleccionado"
End If

If lpErrors And CE_OOP Then
MsgBox "Sin papel"
End If

CloseHandle mHandle
End Sub


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

works...@gmail.com

unread,
Jan 23, 2014, 11:34:21 PM1/23/14
to
lOGRASTES RESOVER ESTO

sALUDOS.
0 new messages