CISA FotoGallery

Statistiche

Tot. visite contenuti : 909754
Home Articoli tecnici General WMI-Printer JOB (Informazioni processi di Stampa)

WMI-Printer JOB (Informazioni processi di Stampa)

Questo Demo mostra come recuperare lo stato dei JOBS della stampante attraverso la Classe Win32_PrintJob di WMI:
 


VARIABILE TIPO PER ESTRARRE I DATI

Private Type prtJob
mCaption As String
mDataType As String
mDescription As String
mDocument As String
mDriverName As String
mElapsedTime As Date
mHostPrintQueue As String
mInstallDate As Date
mJobId As Long
mJobStatus As String
mName As String
mNotify As String
mOwner As String
mPagesPrinted As Long
mParameters As String
mPrintProcessor As String
mPriority As Long
mSize As Long
mStartTime As Date
mStatus As String
mStatusMask As Long
mTimeSubmitted As Date
mTotalPages As Long
mUntilTime As Date
End Type

Public p() As prtJob

Public Function retPrinterJob(ByRef prt() As prtJob)
Dim nIndex As Long
Dim PrintJobSet As Object
Dim printjob As Object
Set PrintJobSet = GetObject("winmgmts:").InstancesOf("Win32_PrintJob")

If (PrintJobSet.Count = 0) Then MsgBox "No print jobs!"
ReDim prt(PrintJobSet.Count)
For Each printjob In PrintJobSet
With prt(nIndex)
.mName = printjob.Name
.mJobId = printjob.JobId
.mStatus = printjob.Status
.mStatus = printjob.TotalPages
.mPagesPrinted = printjob.PagesPrinted
.mDocument = printjob.Document
.mNotify = printjob.Notify
.mElapsedTime = printjob.elapsedtime
.mHostPrintQueue = printjob.HostPrintQueue
.mSize = printjob.size
Debug.Print .mName & vbCrLf & _
.mJobId & vbCrLf & _
.mStatus & vbCrLf & _
.mStatus & vbCrLf & _
.mPagesPrinted & vbCrLf & _
.mDocument & vbCrLf & _
.mNotify & vbCrLf & _
.mElapsedTime & vbCrLf & _
.mHostPrintQueue & vbCrLf & _
.mSize
'// Ecc......!
End With
nIndex = nIndex + 1
Next
Set PrintJobSet=Nothing
set printjob=Nothing
End Function


Alessandro Baraldi