Dica do SistemaEste artigo aplica-se a um sistema operativo diferente do que está a utilizar. Foi desactivado o conteúdo do artigo, que pode não ser relevante para si.
Este artigo descreve como usar funções da interface (API) no Visual Basic de programação de aplicativo Windows para determinar o status da impressora ou o status do trabalho de impressão através de programação. Embora um aplicativo normalmente não tenha que verificar o status de uma impressora antes de imprimir, talvez seja útil determinar o status de uma impressora ou trabalho de impressão através de programação.
O termo "impressora" pode se referir um dispositivo de hardware, uma fila, um driver ou até mesmo uma porta. Neste artigo, o termo "impressora" é definido como uma fila de impressão local. O exemplo de código neste artigo retorna os status que reporta o sistema operacional. Este é o mesmo status em que o spooler de relatórios, que você pode verificar assistindo a fila de impressão local.
Por exemplo, para exibir a fila em um computador que esteja executando o Microsoft Windows 98, clique em Iniciar , aponte para configurações , clique em impressoras e clique duas vezes no ícone da impressora cuja fila que você deseja exibir.
Observação : você não pode se comunicar diretamente com a impressora física. Você não deve ter que fazer isso porque o sistema operacional deve arbitrar acesso para o hardware.
O código de exemplo deste artigo examina a fila de impressão local, que obtém informações do monitor de porta, que por sua vez se comunica com o dispositivo físico. Para obter uma descrição mais detalhada de como isso funciona, consulte os artigos listados na seção "Referências" deste artigo.
Este exemplo relata o status da impressora e dos trabalhos, mas observe que as informações de status do trabalho são geralmente mais confiáveis para aplicativos. Teoricamente, você deve examinar os status da impressora e os trabalhos separadamente, e o código deve inferir o status de "metadados" da fila de. No entanto, para a maioria dos usos, seu código pode contar com os status do trabalho. Além disso, este exemplo percorre os trabalhos e verifica e relata o status de cada trabalho. Isso ocorre porque o seu trabalho pode seguir outro trabalho que está relatando um problema, como sendo a saída de papel ou obtendo obstruído.
Observação : O sistema somente verifica o status quando o sistema tem um trabalho de spool. Caso contrário, a fila é considerada "pronta" porque a fila pode aceitar trabalhos, mesmo se o hardware estiver em um estado de erro. Por exemplo, se o último trabalho foi impresso usado a última parte do papel, o sistema operacional não sabe isso até que o sistema tenta imprimir novamente.
Além disso, embora existam muitas status que podem ser reportados, muitos não são suportados na prática. O hardware da impressora e o monitor de porta determinam quais status ao relatório. Por exemplo, se a impressora está fora do papel e off-line, o status pode ser reportado como "Impressão" porque esse é o que o trabalho está tentando fazer. Portanto, uma fila que exiba "Pronto" não garante que o trabalho de impressão será concluído com êxito.
Este exemplo de código examina somente a fila local, que deve ser suficiente para a maioria dos aplicativos. No entanto, conectando a impressoras remotas pode se tornar bastante complexo. Você pode ter encadeadas filas, no qual a porta para a fila local é realmente outra fila. Você pode ter pool de impressão, na qual várias impressoras trabalham de uma fila super comuns. Quando a arquitetura se torna mais complexa, o código para recuperar um status significativo também se torna mais complexo, e a utilidade do status é reduzida.
No Microsoft Windows 95, Microsoft Windows 98 e Microsoft Windows Millennium Edition somente, você também pode examinar o campo PrinterInfo.Attributes para o bit PRINTER_ATTRIBUTE_WORK_OFFLINE. Esse estado é algo que normalmente ocorre devido a ação do usuário (por exemplo, se o usuário clica com o botão direito um ícone de impressora e, em seguida, clica em Trabalhar off-line ). Este estado não ocorre devido a alteração de estado de um trabalho de impressão, embora o sistema operacional pode forçar o estado se a impressora não pode ser conectada a despool um trabalho. Nesse caso, o status normalmente é relatado como USER_INERVENTION_REQUIRED.
Crie um novo projeto Standard EXE no Visual Basic. Por padrão, é criado o Form1.
No menu Project , clique em Adicionar módulo e, em seguida, adicione o seguinte código:
Option Explicit
Public Declare Function lstrcpy Lib "kernel32" _
Alias "lstrcpyA" _
(ByVal lpString1 As String, _
ByVal lpString2 As String) _
As Long
Public Declare Function OpenPrinter Lib "winspool.drv" _
Alias "OpenPrinterA" _
(ByVal pPrinterName As String, _
phPrinter As Long, _
pDefault As PRINTER_DEFAULTS) _
As Long
Public Declare Function GetPrinter Lib "winspool.drv" Alias "GetPrinterA" _
(ByVal hPrinter As Long, _
ByVal Level As Long, _
pPrinter As Byte, _
ByVal cbBuf As Long, _
pcbNeeded As Long) _
As Long
Public Declare Function ClosePrinter Lib "winspool.drv" _
(ByVal hPrinter As Long) _
As Long
Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _
(Destination As Any, _
Source As Any, _
ByVal Length As Long)
Public Declare Function EnumJobs Lib "winspool.drv" Alias "EnumJobsA" _
(ByVal hPrinter As Long, _
ByVal FirstJob As Long, _
ByVal NoJobs As Long, _
ByVal Level As Long, _
pJob As Byte, _
ByVal cdBuf As Long, _
pcbNeeded As Long, _
pcReturned As Long) _
As Long
' constants for PRINTER_DEFAULTS structure
Public Const PRINTER_ACCESS_USE = &H8
Public Const PRINTER_ACCESS_ADMINISTER = &H4
' constants for DEVMODE structure
Public Const CCHDEVICENAME = 32
Public Const CCHFORMNAME = 32
Public Type PRINTER_DEFAULTS
pDatatype As String
pDevMode As Long
DesiredAccess As Long
End Type
Public Type DEVMODE
dmDeviceName As String * CCHDEVICENAME
dmSpecVersion As Integer
dmDriverVersion As Integer
dmSize As Integer
dmDriverExtra As Integer
dmFields As Long
dmOrientation As Integer
dmPaperSize As Integer
dmPaperLength As Integer
dmPaperWidth As Integer
dmScale As Integer
dmCopies As Integer
dmDefaultSource As Integer
dmPrintQuality As Integer
dmColor As Integer
dmDuplex As Integer
dmYResolution As Integer
dmTTOption As Integer
dmCollate As Integer
dmFormName As String * CCHFORMNAME
dmLogPixels As Integer
dmBitsPerPel As Long
dmPelsWidth As Long
dmPelsHeight As Long
dmDisplayFlags As Long
dmDisplayFrequency As Long
End Type
Type SYSTEMTIME
wYear As Integer
wMonth As Integer
wDayOfWeek As Integer
wDay As Integer
wHour As Integer
wMinute As Integer
wSecond As Integer
wMilliseconds As Integer
End Type
Type JOB_INFO_2
JobId As Long
pPrinterName As Long
pMachineName As Long
pUserName As Long
pDocument As Long
pNotifyName As Long
pDatatype As Long
pPrintProcessor As Long
pParameters As Long
pDriverName As Long
pDevMode As Long
pStatus As Long
pSecurityDescriptor As Long
Status As Long
Priority As Long
Position As Long
StartTime As Long
UntilTime As Long
TotalPages As Long
Size As Long
Submitted As SYSTEMTIME
time As Long
PagesPrinted As Long
End Type
Type PRINTER_INFO_2
pServerName As Long
pPrinterName As Long
pShareName As Long
pPortName As Long
pDriverName As Long
pComment As Long
pLocation As Long
pDevMode As Long
pSepFile As Long
pPrintProcessor As Long
pDatatype As Long
pParameters As Long
pSecurityDescriptor As Long
Attributes As Long
Priority As Long
DefaultPriority As Long
StartTime As Long
UntilTime As Long
Status As Long
cJobs As Long
AveragePPM As Long
End Type
Public Const ERROR_INSUFFICIENT_BUFFER = 122
Public Const PRINTER_STATUS_BUSY = &H200
Public Const PRINTER_STATUS_DOOR_OPEN = &H400000
Public Const PRINTER_STATUS_ERROR = &H2
Public Const PRINTER_STATUS_INITIALIZING = &H8000
Public Const PRINTER_STATUS_IO_ACTIVE = &H100
Public Const PRINTER_STATUS_MANUAL_FEED = &H20
Public Const PRINTER_STATUS_NO_TONER = &H40000
Public Const PRINTER_STATUS_NOT_AVAILABLE = &H1000
Public Const PRINTER_STATUS_OFFLINE = &H80
Public Const PRINTER_STATUS_OUT_OF_MEMORY = &H200000
Public Const PRINTER_STATUS_OUTPUT_BIN_FULL = &H800
Public Const PRINTER_STATUS_PAGE_PUNT = &H80000
Public Const PRINTER_STATUS_PAPER_JAM = &H8
Public Const PRINTER_STATUS_PAPER_OUT = &H10
Public Const PRINTER_STATUS_PAPER_PROBLEM = &H40
Public Const PRINTER_STATUS_PAUSED = &H1
Public Const PRINTER_STATUS_PENDING_DELETION = &H4
Public Const PRINTER_STATUS_PRINTING = &H400
Public Const PRINTER_STATUS_PROCESSING = &H4000
Public Const PRINTER_STATUS_TONER_LOW = &H20000
Public Const PRINTER_STATUS_USER_INTERVENTION = &H100000
Public Const PRINTER_STATUS_WAITING = &H2000
Public Const PRINTER_STATUS_WARMING_UP = &H10000
Public Const JOB_STATUS_PAUSED = &H1
Public Const JOB_STATUS_ERROR = &H2
Public Const JOB_STATUS_DELETING = &H4
Public Const JOB_STATUS_SPOOLING = &H8
Public Const JOB_STATUS_PRINTING = &H10
Public Const JOB_STATUS_OFFLINE = &H20
Public Const JOB_STATUS_PAPEROUT = &H40
Public Const JOB_STATUS_PRINTED = &H80
Public Const JOB_STATUS_DELETED = &H100
Public Const JOB_STATUS_BLOCKED_DEVQ = &H200
Public Const JOB_STATUS_USER_INTERVENTION = &H400
Public Const JOB_STATUS_RESTART = &H800
Public Function GetString(ByVal PtrStr As Long) As String
Dim StrBuff As String * 256
'Check for zero address
If PtrStr = 0 Then
GetString = " "
Exit Function
End If
'Copy data from PtrStr to buffer.
CopyMemory ByVal StrBuff, ByVal PtrStr, 256
'Strip any trailing nulls from string.
GetString = StripNulls(StrBuff)
End Function
Public Function StripNulls(OriginalStr As String) As String
'Strip any trailing nulls from input string.
If (InStr(OriginalStr, Chr(0)) > 0) Then
OriginalStr = Left(OriginalStr, InStr(OriginalStr, Chr(0)) - 1)
End If
'Return modified string.
StripNulls = OriginalStr
End Function
Public Function PtrCtoVbString(Add As Long) As String
Dim sTemp As String * 512
Dim x As Long
x = lstrcpy(sTemp, Add)
If (InStr(1, sTemp, Chr(0)) = 0) Then
PtrCtoVbString = ""
Else
PtrCtoVbString = Left(sTemp, InStr(1, sTemp, Chr(0)) - 1)
End If
End Function
Public Function CheckPrinterStatus(PI2Status As Long) As String
Dim tempStr As String
If PI2Status = 0 Then ' Return "Ready"
CheckPrinterStatus = "Printer Status = Ready" & vbCrLf
Else
tempStr = "" ' Clear
If (PI2Status And PRINTER_STATUS_BUSY) Then
tempStr = tempStr & "Busy "
End If
If (PI2Status And PRINTER_STATUS_DOOR_OPEN) Then
tempStr = tempStr & "Printer Door Open "
End If
If (PI2Status And PRINTER_STATUS_ERROR) Then
tempStr = tempStr & "Printer Error "
End If
If (PI2Status And PRINTER_STATUS_INITIALIZING) Then
tempStr = tempStr & "Initializing "
End If
If (PI2Status And PRINTER_STATUS_IO_ACTIVE) Then
tempStr = tempStr & "I/O Active "
End If
If (PI2Status And PRINTER_STATUS_MANUAL_FEED) Then
tempStr = tempStr & "Manual Feed "
End If
If (PI2Status And PRINTER_STATUS_NO_TONER) Then
tempStr = tempStr & "No Toner "
End If
If (PI2Status And PRINTER_STATUS_NOT_AVAILABLE) Then
tempStr = tempStr & "Not Available "
End If
If (PI2Status And PRINTER_STATUS_OFFLINE) Then
tempStr = tempStr & "Off Line "
End If
If (PI2Status And PRINTER_STATUS_OUT_OF_MEMORY) Then
tempStr = tempStr & "Out of Memory "
End If
If (PI2Status And PRINTER_STATUS_OUTPUT_BIN_FULL) Then
tempStr = tempStr & "Output Bin Full "
End If
If (PI2Status And PRINTER_STATUS_PAGE_PUNT) Then
tempStr = tempStr & "Page Punt "
End If
If (PI2Status And PRINTER_STATUS_PAPER_JAM) Then
tempStr = tempStr & "Paper Jam "
End If
If (PI2Status And PRINTER_STATUS_PAPER_OUT) Then
tempStr = tempStr & "Paper Out "
End If
If (PI2Status And PRINTER_STATUS_OUTPUT_BIN_FULL) Then
tempStr = tempStr & "Output Bin Full "
End If
If (PI2Status And PRINTER_STATUS_PAPER_PROBLEM) Then
tempStr = tempStr & "Page Problem "
End If
If (PI2Status And PRINTER_STATUS_PAUSED) Then
tempStr = tempStr & "Paused "
End If
If (PI2Status And PRINTER_STATUS_PENDING_DELETION) Then
tempStr = tempStr & "Pending Deletion "
End If
If (PI2Status And PRINTER_STATUS_PRINTING) Then
tempStr = tempStr & "Printing "
End If
If (PI2Status And PRINTER_STATUS_PROCESSING) Then
tempStr = tempStr & "Processing "
End If
If (PI2Status And PRINTER_STATUS_TONER_LOW) Then
tempStr = tempStr & "Toner Low "
End If
If (PI2Status And PRINTER_STATUS_USER_INTERVENTION) Then
tempStr = tempStr & "User Intervention "
End If
If (PI2Status And PRINTER_STATUS_WAITING) Then
tempStr = tempStr & "Waiting "
End If
If (PI2Status And PRINTER_STATUS_WARMING_UP) Then
tempStr = tempStr & "Warming Up "
End If
'Did you find a known status?
If Len(tempStr) = 0 Then
tempStr = "Unknown Status of " & PI2Status
End If
'Return the Status
CheckPrinterStatus = "Printer Status = " & tempStr & vbCrLf
End If
End Function
Adicione três controles CommandButton .
Adicione três controles TextBox ao Form1 e configure os controles TextBox da seguinte maneira:
Defina a propriedade MultiLine de cada controle TextBox para True .
Tamanho de cada TextBox para aproximadamente cinco polegadas de largura e três polegadas longas.
Defina a propriedade ScrollBars de cada controle TextBox para 2 - vertical .
Adicione um controle Timer ao Form1.
Adicione o seguinte código ao módulo do formulário:
Option Explicit
Private Sub Command1_Click()
'Enable the timer to begin printer status checks.
Timer1.Enabled = True
'Enable and disable start and stop buttons.
Command1.Enabled = False
Command2.Enabled = True
Command3.Enabled = True
End Sub
Private Sub Command2_Click()
'Disable timer to stop further printer checks.
Timer1.Enabled = False
'Enable and disable start and stop buttons.
Command1.Enabled = True
Command2.Enabled = False
Command3.Enabled = True
End Sub
Private Sub Command3_Click()
'Clear the status info.
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
End Sub
Private Sub Form_Load()
'Initialize captions for control buttons.
Command1.Caption = "Start"
Command2.Caption = "Stop"
Command3.Caption = "Clear"
'Clear the status info.
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Command1.Enabled = True
'Disable stop and clear buttons.
Command2.Enabled = False
Command3.Enabled = False
'Set interval for printer status checking to 1/2 second.
Timer1.Enabled = False
Timer1.Interval = 500
End Sub
Private Sub Timer1_Timer()
Dim PrinterStatus As String
Dim JobStatus As String
Dim ErrorInfo As String
'Clear the status info for new info/status.
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
'Call sub to perform check.
Text1.Text = CheckPrinter(PrinterStatus, JobStatus)
Text2.Text = PrinterStatus
Text3.Text = JobStatus
End Sub
Public Function CheckPrinter(PrinterStr As String, JobStr As String) As String
Dim hPrinter As Long
Dim ByteBuf As Long
Dim BytesNeeded As Long
Dim PI2 As PRINTER_INFO_2
Dim JI2 As JOB_INFO_2
Dim PrinterInfo() As Byte
Dim JobInfo() As Byte
Dim result As Long
Dim LastError As Long
Dim PrinterName As String
Dim tempStr As String
Dim NumJI2 As Long
Dim pDefaults As PRINTER_DEFAULTS
Dim I As Integer
'Set a default return value if no errors occur.
CheckPrinter = "Printer info retrieved"
'NOTE: You can pick a printer from the Printers Collection
'or use the EnumPrinters() API to select a printer name.
'Use the default printer of Printers collection.
'This is typically, but not always, the system default printer.
PrinterName = Printer.DeviceName
'Set desired access security setting.
pDefaults.DesiredAccess = PRINTER_ACCESS_USE
'Call API to get a handle to the printer.
result = OpenPrinter(PrinterName, hPrinter, pDefaults)
If result = 0 Then
'If an error occurred, display an error and exit sub.
CheckPrinter = "Cannot open printer " & PrinterName & _
", Error: " & Err.LastDllError
Exit Function
End If
'Init BytesNeeded
BytesNeeded = 0
'Clear the error object of any errors.
Err.Clear
'Determine the buffer size that is needed to get printer info.
result = GetPrinter(hPrinter, 2, 0&, 0&, BytesNeeded)
'Check for error calling GetPrinter.
If Err.LastDllError <> ERROR_INSUFFICIENT_BUFFER Then
'Display an error message, close printer, and exit sub.
CheckPrinter = " > GetPrinter Failed on initial call! <"
ClosePrinter hPrinter
Exit Function
End If
'Note that in Charles Petzold's book "Programming Windows 95," he
'states that because of a problem with GetPrinter on Windows 95 only, you
'must allocate a buffer as much as three times larger than the value
'returned by the initial call to GetPrinter. This is not done here.
ReDim PrinterInfo(1 To BytesNeeded)
ByteBuf = BytesNeeded
'Call GetPrinter to get the status.
result = GetPrinter(hPrinter, 2, PrinterInfo(1), ByteBuf, _
BytesNeeded)
'Check for errors.
If result = 0 Then
'Determine the error that occurred.
LastError = Err.LastDllError()
'Display error message, close printer, and exit sub.
CheckPrinter = "Couldn't get Printer Status! Error = " _
& LastError
ClosePrinter hPrinter
Exit Function
End If
'Copy contents of printer status byte array into a
'PRINTER_INFO_2 structure to separate the individual elements.
CopyMemory PI2, PrinterInfo(1), Len(PI2)
'Check if printer is in ready state.
PrinterStr = CheckPrinterStatus(PI2.Status)
'Add printer name, driver, and port to list.
PrinterStr = PrinterStr & "Printer Name = " & _
GetString(PI2.pPrinterName) & vbCrLf
PrinterStr = PrinterStr & "Printer Driver Name = " & _
GetString(PI2.pDriverName) & vbCrLf
PrinterStr = PrinterStr & "Printer Port Name = " & _
GetString(PI2.pPortName) & vbCrLf
'Call API to get size of buffer that is needed.
result = EnumJobs(hPrinter, 0&, &HFFFFFFFF, 2, ByVal 0&, 0&, _
BytesNeeded, NumJI2)
'Check if there are no current jobs, and then display appropriate message.
If BytesNeeded = 0 Then
JobStr = "No Print Jobs!"
Else
'Redim byte array to hold info about print job.
ReDim JobInfo(0 To BytesNeeded)
'Call API to get print job info.
result = EnumJobs(hPrinter, 0&, &HFFFFFFFF, 2, JobInfo(0), _
BytesNeeded, ByteBuf, NumJI2)
'Check for errors.
If result = 0 Then
'Get and display error, close printer, and exit sub.
LastError = Err.LastDllError
CheckPrinter = " > EnumJobs Failed on second call! < Error = " _
& LastError
ClosePrinter hPrinter
Exit Function
End If
'Copy contents of print job info byte array into a
'JOB_INFO_2 structure to separate the individual elements.
For I = 0 To NumJI2 - 1 ' Loop through jobs and walk the buffer
CopyMemory JI2, JobInfo(I * Len(JI2)), Len(JI2)
' List info available on Jobs.
Debug.Print "Job ID" & vbTab & JI2.JobId
Debug.Print "Name Of Printer" & vbTab & _
GetString(JI2.pPrinterName)
Debug.Print "Name Of Machine That Created Job" & vbTab & _
GetString(JI2.pMachineName)
Debug.Print "Print Job Owner's Name" & vbTab & _
GetString(JI2.pUserName)
Debug.Print "Name Of Document" & vbTab & GetString(JI2.pDocument)
Debug.Print "Name Of User To Notify" & vbTab & _
GetString(JI2.pNotifyName)
Debug.Print "Type Of Data" & vbTab & GetString(JI2.pDatatype)
Debug.Print "Print Processor" & vbTab & _
GetString(JI2.pPrintProcessor)
Debug.Print "Print Processor Parameters" & vbTab & _
GetString(JI2.pParameters)
Debug.Print "Print Driver Name" & vbTab & _
GetString(JI2.pDriverName)
Debug.Print "Print Job 'P' Status" & vbTab & _
GetString(JI2.pStatus)
Debug.Print "Print Job Status" & vbTab & JI2.Status
Debug.Print "Print Job Priority" & vbTab & JI2.Priority
Debug.Print "Position in Queue" & vbTab & JI2.Position
Debug.Print "Earliest Time Job Can Be Printed" & vbTab & _
JI2.StartTime
Debug.Print "Latest Time Job Will Be Printed" & vbTab & _
JI2.UntilTime
Debug.Print "Total Pages For Entire Job" & vbTab & JI2.TotalPages
Debug.Print "Size of Job In Bytes" & vbTab & JI2.Size
'Because of a bug in Windows NT 3.51, the time member is not set correctly.
'Therefore, do not use the time member on Windows NT 3.51.
Debug.Print "Elapsed Print Time" & vbTab & JI2.time
Debug.Print "Pages Printed So Far" & vbTab & JI2.PagesPrinted
'Display basic job status info.
JobStr = JobStr & "Job ID = " & JI2.JobId & _
vbCrLf & "Total Pages = " & JI2.TotalPages & vbCrLf
tempStr = "" 'Clear
'Check for a ready state.
If JI2.pStatus = 0& Then ' If pStatus is Null, check Status.
If JI2.Status = 0 Then
tempStr = tempStr & "Ready! " & vbCrLf
Else 'Check for the various print job states.
If (JI2.Status And JOB_STATUS_SPOOLING) Then
tempStr = tempStr & "Spooling "
End If
If (JI2.Status And JOB_STATUS_OFFLINE) Then
tempStr = tempStr & "Off line "
End If
If (JI2.Status And JOB_STATUS_PAUSED) Then
tempStr = tempStr & "Paused "
End If
If (JI2.Status And JOB_STATUS_ERROR) Then
tempStr = tempStr & "Error "
End If
If (JI2.Status And JOB_STATUS_PAPEROUT) Then
tempStr = tempStr & "Paper Out "
End If
If (JI2.Status And JOB_STATUS_PRINTING) Then
tempStr = tempStr & "Printing "
End If
If (JI2.Status And JOB_STATUS_USER_INTERVENTION) Then
tempStr = tempStr & "User Intervention Needed "
End If
If Len(tempStr) = 0 Then
tempStr = "Unknown Status of " & JI2.Status
End If
End If
Else
' Dereference pStatus.
tempStr = PtrCtoVbString(JI2.pStatus)
End If
'Report the Job status.
JobStr = JobStr & tempStr & vbCrLf
Debug.Print JobStr & tempStr
Next I
End If
'Close the printer handle.
ClosePrinter hPrinter
End Function
Vá para a fila de impressão e, em seguida, faça uma pausa na impressora. Observe que talvez seja necessário uma impressora local em vez de uma impressora de rede para pausar a fila de impressão.
Execute o projeto de exemplo e, em seguida, clique em Iniciar .
Executar um ou mais operações de impressão de outro aplicativo, como o bloco de notas. As informações de impressora são exibidas nas caixas de texto. Observe que detalhes de trabalho são exibidas na janela Verificação imediata.
Se necessário, clique em Parar no formulário para percorrer as caixas de texto e a janela Verificação imediata para exibir informações sobre a impressora.
Somente um driver de dispositivo específico pode obter informações de status em tempo real, preciso de impressora. Esse código obtém o mesmo status que reporta o spooler do Windows.
O status exato é relatado pode variar com diferentes impressoras e drivers.
Para obter informações adicionais sobre como o status da impressora e status do trabalho de impressão são definidas, clique no número abaixo para ler o artigo na Base de dados de Conhecimento da Microsoft:
160129
(http://support.microsoft.com/kb/160129/EN-US/
)
COMO: Obter o status de uma impressora e um trabalho de impressão
Para obter informações adicionais sobre como usar a função de API EnumPrinters, clique no número abaixo para ler o artigo na Base de dados de Conhecimento da Microsoft:
166008
(http://support.microsoft.com/kb/166008/EN-US/
)
ACC: Enumerando locais e impressoras de rede
Para obter informações adicionais sobre como recuperar informações de trabalho de impressão no Microsoft Visual C++, clique nos números abaixo para ler os artigos na Base de dados de Conhecimento da Microsoft:
228769
(http://support.microsoft.com/kb/228769/EN-US/
)
COMO: Recuperar informações de trabalho de impressão
158828
(http://support.microsoft.com/kb/158828/EN-US/
)
COMO: Como chamada de enumeração de spooler de Win32 APIs corretamente
IMPORTANTE: Este artigo foi traduzido por um sistema de tradução automática (também designado por Machine Translation ou MT), não tendo sido portanto traduzido ou revisto por pessoas. A Microsoft possui artigos traduzidos por aplicações (MT) e artigos traduzidos por tradutores profissionais, com o objetivo de oferecer em português a totalidade dos artigos existentes na base de dados de suporte. No entanto, a tradução automática não é sempre perfeita, podendo conter erros de vocabulário, sintaxe ou gramática. A Microsoft não é responsável por incoerências, erros ou prejuízos ocorridos em decorrência da utilização dos artigos MT por parte dos nossos clientes. A Microsoft realiza atualizações freqüentes ao software de tradução automática (MT). Obrigado.
Clique aqui para ver a versão em Inglês deste artigo: 202480
(http://support.microsoft.com/kb/202480/en-us/
)
Quanto esforço foi necessário para seguir os procedimentos deste artigo?
Muito baixo
Baixo
Moderado
Alto
Muito alto
Diga-nos o porque e o que podemos fazer para melhorar esta informação
Obrigado! Seus comentários são usados para nos ajudar a aperfeiçoar o conteúdo de suporte. Para obter mais opções de ajuda, visite a Home Page de Ajuda e Suporte.