SHInvokePrinterCommand function
Executes a command on a printer object.
Syntax
BOOL SHInvokePrinterCommand( _In_opt_ HWND hwnd, UINT uAction, _In_ LPCTSTR lpBuf1, _In_opt_ LPCTSTR lpBuf2, BOOL fModal );
Parameters
- hwnd [in, optional]
-
Type: HWND
The handle of the parent window of any windows or dialog boxes that are created during the operation.
- uAction
-
Type: UINT
The type of printer operation to perform. One of the following values:
-
0x0. Open the printer specified by lpBuf1. The lpBuf2 parameter is ignored.
-
0x1. Display the property pages for the printer specified by lpBuf1. The lpBuf2 parameter can be NULL or can name a specific property sheet to display, either by name or number. If the high WORD of lpBuf2 is nonzero, it is assumed that this parameter is a pointer to a buffer that contains the name of the sheet to open. Otherwise, lpBuf2 is seen as the zero-based index of the property sheet to open.
-
0x2. Install the network printer specified by lpBuf1. The lpBuf2 parameter is ignored.
-
0x3. Create a shortcut to the network printer specified by lpBuf1. The lpBuf2 parameter specifies the drive and path of the folder in which to create the shortcut. The network printer must already have been installed on the local computer.
-
0x4. Print a test page on the printer specified by lpBuf1. The lpBuf2 parameter is ignored.
-
0x5. Open the network printer specified by lpBuf1. The lpBuf2 parameter is ignored.
-
0x6. Display the default document properties for the printer specified by lpBuf1. The lpBuf2 parameter is ignored.
-
0x7. Display the properties for the printer server specified by lpBuf1. The lpBuf2 parameter is ignored.
- lpBuf1 [in]
-
Type: LPCTSTR
Pointer to a null-terminated string that contains additional information for the printer command. The information contained in this parameter depends upon the value of uAction.
- lpBuf2 [in, optional]
-
Type: LPCTSTR
Pointer to a null-terminated string that contains additional information for the printer command. The information contained in this parameter depends upon the value of uAction.
- fModal
-
Type: BOOL
TRUE to specify that SHInvokePrinterCommand should not return until the command is completed; FALSE if the function should return as soon as the command is initialized.
Return value
Type: BOOL
Returns TRUE if successful; otherwise, FALSE.
Remarks
When a printer name is specified by lpBuf1, the name can either be the name of a local printer or the server and share name of a network printer. When specifying a network printer name, the name must be specified in this format:
"\\<server><shared printer name>"
This function is implemented in Shell versions 4.71 and later. In order to maintain backward compatibility with previous Shell versions, this function should not be used explicitly. Instead, the LoadLibrary and GetProcAddress functions should be used to obtain the function address.
Requirements
|
Minimum supported client |
Windows 2000 Professional, Windows XP [desktop apps only] |
|---|---|
|
Minimum supported server |
Windows 2000 Server [desktop apps only] |
|
Header |
|
|
Library |
|
|
DLL |
|
|
Unicode and ANSI names |
SHInvokePrinterCommandW (Unicode) and SHInvokePrinterCommandA (ANSI) |