Results 1 to 3 of 3

Thread: [Resolved] Showing Printer Preferences Page without CommonDialog

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2011
    Posts
    15

    Question [Resolved] Showing Printer Preferences Page without CommonDialog

    Hi guys!

    I'm writing a VB6 program that needs to print some forms and I don't want to use CommonDialog in it, cause I want to use this program in portable mode, without installation.

    I've found a code that shows the Printer Properties Page:
    Code:
    Private Declare Function SHInvokePrinterCommand Lib "shell32.dll" Alias "SHInvokePrinterCommandA" (ByVal hWnd As Long, ByVal uAction As Long, ByVal lBuf1 As String, ByVal lBuf2 As String, ByVal fModal As Boolean) As Long
    
    Private Sub Command1_Click()
    
    SHInvokePrinterCommand Me.hWnd, &H1, Printer.DeviceName, vbNull, False
    
    End Sub
    Thats enough for me, but... at the bottom of the properties page, there's a Command Button on the left that gives the Printer Preferences Page form...

    Anyone knows the API Function that calls/shows directly that Preferences Page? Can I invoke it at my Command1_Click() sub?

    Thanks in advance.

    Best regards.
    Last edited by Tedioboy; Jul 27th, 2011 at 03:53 AM.

  2. #2
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Showing Printer Preferences Page without CommonDialog

    You use the same API function but with a different action flag.
    Code:
    Private Sub Command1_Click()
        Const PRINTACTION_DOCUMENTDEFAULTS As Long = 6
        SHInvokePrinterCommand Me.hWnd, PRINTACTION_DOCUMENTDEFAULTS, Printer.DeviceName, vbNullString, False
    End Sub

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2011
    Posts
    15

    Re: Showing Printer Preferences Page without CommonDialog

    Great! Just what I asked for!!!
    You're the One, Joacim. Thanks a lot!

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