The PrinterMessageBox function displays a message box that lets an application that is printing notify the user of a printing job error. If the owner of the job is logged on remotely, the function sends a net popup to the owner. If the user selects Cancel in the message box, the function cancels the print job; otherwise, the function clears the job error status, and the system tries to print the job again.
HPRINTER PrinterMessageBox (
HANDLE hPrinter, | // handle of printer |
DWORD Error, | // error identifier |
HWND hWnd, | // handle of owner window |
LPTSTR pText, | // pointer to message box text |
LPTSTR pCaption, | // pointer to message box title |
DWORD dwType | // style of message box |
); |
Parameters
hPrinter
Identifies the printer to which the job was sent.
Error
Specifies the error that occurred. This parameter can be one of the following values:
Value | Meaning |
ERROR_OUT_OF_PAPER | The printer is out of paper. |
ERROR_NOT_READY | The printer is not ready. |
hWnd
Identifies an owner window for the message box the function creates. If this parameter is NULL, the message box has no owner window.
pText
Points to a null-terminated string that specifies the message to be displayed.
pCaption
Points to a null-terminated string that specifies the dialog box title. If this parameter is NULL, the function uses the default title "Error".
dwType
Specifies the contents and behavior of the dialog box. This parameter can be a combination of any of the values accepted by the MessageBox function's fourth parameter; however, it is recommended that an application use the following combination:
MB_ICONSTOP | MB_RETRYCANCEL | MB_SETFOREGROUND
Return Values
If PrinterMessageBox sends a net popup, the return value is IDOK. Otherwise, the function returns the value returned by the message box the function displays. Two typical return values are the following:
Value | Meaning |
IDCANCEL | Cancel button was selected. |
IDRETRY | Retry button was selected. |
For a more complete list of message box return values, see MessageBox.
See Also