Results 1 to 3 of 3

Thread: Printer Ready Or Not

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2002
    Location
    INDIA
    Posts
    169

    Red face Printer Ready Or Not

    hi, is there any way to find out from within my application wether the default printer is ready or not??


    thanx in advance

  2. #2
    PowerPoster
    Join Date
    Aug 2002
    Location
    NY, NY
    Posts
    2,139
    This is a snipet code from AllApi.net:

    Private Declare Function OpenPrinter Lib "winspool.drv" Alias "OpenPrinterA" (ByVal pPrinterName As String, phPrinter As Long, pDefault As Any) As Long
    Private Declare Function ClosePrinter Lib "winspool.drv" (ByVal hPrinter As Long) As Long
    Private 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 Any, ByVal cdBuf As Long, pcbNeeded As Long, pcReturned As Long) As Long
    Private Sub Form_Load()
    'KPD-Team 2001
    'URL: http://www.allapi.net/
    'E-Mail: [email protected]
    Dim hPrinter As Long, lNeeded As Long, lReturned As Long
    Dim lJobCount As Long
    OpenPrinter Printer.DeviceName, hPrinter, ByVal 0&
    EnumJobs hPrinter, 0, 99, 1, ByVal 0&, 0, lNeeded, lReturned
    If lNeeded > 0 Then
    ReDim byteJobsBuffer(lNeeded - 1) As Byte
    EnumJobs hPrinter, 0, 99, 1, byteJobsBuffer(0), lNeeded, lNeeded, lReturned
    If lReturned > 0 Then
    lJobCount = lReturned
    Else
    lJobCount = 0
    End If
    Else
    lJobCount = 0
    End If
    ClosePrinter hPrinter
    MsgBox "Jobs in printer queue: " + CStr(lJobCount), vbInformation
    End Sub

    Tell us if that's what you need.

    Roy

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Apr 2002
    Location
    INDIA
    Posts
    169

    Thanx

    Thanx Let me go throught it and then I will definitely reply back.

    Thanx once again.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width