README.md
December 5, 2022 ยท View on GitHub
Description
Shows the printer document properties dialog box from code.
More Info
This entry in Shell32.dll is only present in version 4.71 and above (Windows NT 4 and Internet Explorer 4.0 or above)
| Submitted On | |
| By | Duncan Jones |
| Level | Intermediate |
| User Rating | 4.3 (13 globes from 3 users) |
| Compatibility | VB 5.0, VB 6.0 |
| Category | Windows API Call/ Explanation |
| World | Visual Basic |
| Archive File |
API Declarations
'SHSTDAPI_(BOOL) SHInvokePrinterCommandA(HWND hwnd, UINT uAction, LPCSTR lpBuf1, LPCSTR lpBuf2, BOOL fModal);
Private Declare Function SHInvokePrinterCommand Lib "shell32.dll" Alias "SHInvokePrinterCommandA" (ByVal hWnd As Long, ByVal uAction As enPrinterActions, ByVal Buffer1 As String, ByVal Buffer2 As String, ByVal Modal As Long) As Long
Public Enum enPrinterActions
PRINTACTION_OPEN = 0
PRINTACTION_PROPERTIES = 1
PRINTACTION_NETINSTALL = 2
PRINTACTION_NETINSTALLLINK = 3
PRINTACTION_TESTPAGE = 4
PRINTACTION_OPENNETPRN = 5
PRINTACTION_DOCUMENTDEFAULTS = 6
PRINTACTION_SERVERPROPERTIES = 7
End Enum
Source Code
Public Sub DisplayDocumentDefaults(ByVal PrinterName As String, ByVal hWnd As Long)
Dim lRet As Long
'\\ Only version 4.71 and above have this :. jump over error
On Error Resume Next
lRet = SHInvokePrinterCommand(hWnd, PRINTACTION_DOCUMENTDEFAULTS, PrinterName, "", 0)
End Sub