Results 1 to 3 of 3

Thread: Printer Properties

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 1999
    Location
    MA, USA
    Posts
    523

    Post

    I'm having a hard time trying to run printer's properties via VB. Does anyone know how to do it?

    ------------------
    Visual Basic Programmer (at least I want to be one)
    ------------------
    PolComSoft
    You will hear a lot about it.


  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    Sure, use the PrinterProperties API, eg.
    Code:
    Private Declare Function PrinterProperties Lib "winspool.drv" (ByVal hwnd As Long, ByVal hPrinter As Long) As Long
    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 Sub Command1_Click()
        Dim lhPrinter As Long
        If OpenPrinter(ByVal Combo1, lhPrinter, ByVal 0&) Then
            Call PrinterProperties(hwnd, lhPrinter)
            Call ClosePrinter(lhPrinter)
        End If
    End Sub
    
    Private Sub Form_Load()
        Dim oPRN As Printer
        For Each oPRN In Printers
            Combo1.AddItem oPRN.DeviceName
        Next
        Combo1 = Printer.DeviceName
    End Sub

    ------------------
    Aaron Young
    Analyst Programmer
    [email protected]
    [email protected]

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Oct 1999
    Location
    MA, USA
    Posts
    523

    Post

    Thanks Again Aaron

    ------------------
    Visual Basic Programmer (at least I want to be one)
    ------------------
    PolComSoft
    You will hear a lot about it.


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