Skip to content

Latest commit

 

History

History
164 lines (95 loc) · 6.29 KB

nf-shellapi-shinvokeprintercommanda.md

File metadata and controls

164 lines (95 loc) · 6.29 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:shellapi.SHInvokePrinterCommandA
SHInvokePrinterCommandA function (shellapi.h)
Executes a command on a printer object. (ANSI)
PRINTACTION_DOCUMENTDEFAULTS
PRINTACTION_NETINSTALL
PRINTACTION_NETINSTALLLINK
PRINTACTION_OPEN
PRINTACTION_OPENNETPRN
PRINTACTION_PROPERTIES
PRINTACTION_SERVERPROPERTIES
PRINTACTION_TESTPAGE
SHInvokePrinterCommandA
shellapi/SHInvokePrinterCommandA
shell\SHInvokePrinterCommand.htm
shell
32a5802f-cef7-4dbd-affd-82285fe97a8c
12/05/2018
PRINTACTION_DOCUMENTDEFAULTS, PRINTACTION_NETINSTALL, PRINTACTION_NETINSTALLLINK, PRINTACTION_OPEN, PRINTACTION_OPENNETPRN, PRINTACTION_PROPERTIES, PRINTACTION_SERVERPROPERTIES, PRINTACTION_TESTPAGE, SHInvokePrinterCommand, SHInvokePrinterCommand function [Windows Shell], SHInvokePrinterCommandA, SHInvokePrinterCommandW, _win32_SHInvokePrinterCommand, shell.SHInvokePrinterCommand, shellapi/SHInvokePrinterCommand, shellapi/SHInvokePrinterCommandA, shellapi/SHInvokePrinterCommandW
shellapi.h
Windows
Windows 2000 Professional, Windows XP [desktop apps only]
Windows 2000 Server [desktop apps only]
SHInvokePrinterCommandW (Unicode) and SHInvokePrinterCommandA (ANSI)
Shell32.lib
Shell32.dll (version 4.71 or later)
Windows
19H1
SHInvokePrinterCommandA
shellapi/SHInvokePrinterCommandA
c++
APIRef
kbSyntax
DllExport
Shell32.dll
SHInvokePrinterCommand
SHInvokePrinterCommandA
SHInvokePrinterCommandW

SHInvokePrinterCommandA function

-description

Executes a command on a printer object.

Note  This function has been deprecated as of Windows Vista. It is recommended that, in its place, you invoke verbs on printers through IContextMenu or ShellExecute.
 

-parameters

-param hwnd [in, optional]

Type: HWND

The handle of the parent window of any windows or dialog boxes that are created during the operation.

-param uAction

Type: UINT

The type of printer operation to perform. One of the following values:

PRINTACTION_OPEN (0)

0x0. Open the printer specified by lpBuf1. The lpBuf2 parameter is ignored.

PRINTACTION_PROPERTIES (1)

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.

PRINTACTION_NETINSTALL (2)

0x2. Install the network printer specified by lpBuf1. The lpBuf2 parameter is ignored.

PRINTACTION_NETINSTALLLINK (3)

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.

PRINTACTION_TESTPAGE (4)

0x4. Print a test page on the printer specified by lpBuf1. The lpBuf2 parameter is ignored.

PRINTACTION_OPENNETPRN (5)

0x5. Open the network printer specified by lpBuf1. The lpBuf2 parameter is ignored.

PRINTACTION_DOCUMENTDEFAULTS (6)

0x6. Display the default document properties for the printer specified by lpBuf1. The lpBuf2 parameter is ignored.

PRINTACTION_SERVERPROPERTIES (7)

0x7. Display the properties for the printer server specified by lpBuf1. The lpBuf2 parameter is ignored.

-param 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.

-param 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.

-param 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.

-returns

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.

Note

The shellapi.h header defines SHInvokePrinterCommand as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.