Hi to all,

Do anybody knows how to display the complete dialog of a printer properties, showing all tabs of a printer properties like when you are manually doing it on controlpanel>printer&fax... i wanted to show it that way...

I have a program that can show the printer properties... here the program...

Option Explicit

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 PRINTER_DEFAULTS) As Long

Private Declare Function ClosePrinter Lib "winspool.drv" _
  (ByVal hPrinter As Long) As Long
  
Private Type PRINTER_DEFAULTS
   pDatatype As Long ' String
   pDevMode As Long
   pDesiredAccess As Long
End Type

Private Const STANDARD_RIGHTS_REQUIRED = &HF0000
Private Const PRINTER_ACCESS_ADMINISTER = &H4
Private Const PRINTER_ACCESS_USE = &H8
Private Const PRINTER_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or _
   PRINTER_ACCESS_ADMINISTER Or PRINTER_ACCESS_USE)
   
Public Function DisplayPrinterProperties(DeviceName As String) _
  As Boolean
         
On Error GoTo ErrorHandler
Dim lAns As Long, hPrinter As Long
Dim typPD As PRINTER_DEFAULTS

typPD.pDatatype = 0
typPD.pDesiredAccess = PRINTER_ALL_ACCESS
typPD.pDevMode = 0
lAns = OpenPrinter(Printer.DeviceName, hPrinter, typPD)
If lAns <> 0 Then
    lAns = PrinterProperties(Form1.hwnd, hPrinter)
    DisplayPrinterProperties = lAns <> 0
End If

ErrorHandler:
If hPrinter <> 0 Then ClosePrinter hPrinter
    
End Function

but the problem is it only shows the last two tabs or sometimes the last tab only of the printer property... what i wanted is to show all the tabs, so that the user can change the settings of the printer on my program and they dont need to go control panel>printer & faxes and manually do it ... right click then properties.... i just want to lessen the hassle to the user...

can you check is thers something i missin in the code thats make the program not displaying all the tabs of the printer property....


can you give me an idea how can i do that... thanks

I have the same problem.
Did you found a solution?
Tks. Rui

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.