Results 1 to 39 of 39

Thread: [RESOLVED] How to determine if a printer is connected and available

Threaded View

  1. #11
    Default Member Bonnie West's Avatar
    Join Date
    Jun 2012
    Location
    InIDE
    Posts
    4,060

    Re: How to determine if a printer is connected and available

    @ camoore

    When you step through that code, what is the value of PRINTER_INFO_6? I'm assuming that a value of 0 means that the printer is "ready", as suggested in the Getting the status of the selected printer from Visual Basic article:

    Code:
    Public Enum Printer_Status
       PRINTER_STATUS_READY = &H0
    There isn't actually a constant like that defined anywhere in the Windows header files. Like the author of that article, we're both assuming that if no other bit (the PRINTER_INFO_6's dwStatus member is, in fact, a bit field) is set, then it probably means that the printer is ready. You may want to see which bits are really set when you call that function.



    EDIT

    BTW, the MSDN doc describes the meaning of each constant whose values are enumerated in the Merrion article. The ampersand (&) after the numeric literals in my code forces VB6 to treat them as Longs instead of Integers so that no run time conversion needs to take place.
    Last edited by Bonnie West; Sep 12th, 2013 at 06:02 AM.
    On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
    Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)

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