[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.
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
Re: Showing Printer Preferences Page without CommonDialog
Great! Just what I asked for!!!
You're the One, Joacim. Thanks a lot!