SetStatusBackFunction¶
Description
Registers the callback function called when a change in the printer status is detected.
Syntax
INT SetStatusBackFunction( INT i_hdl, INT ( CALLBACK EXPORT *lpStatusCB ) ( DWORD o_st ) )
Parameter
i_hdl
API handle
Specify the API handle retrieved by OpenMonPrinter.
lpStatusCB
Callback function address
Specify the address of an application-defined callback function that receives the printer status.
When NULL is specified, monitoring of the printer status is canceled.
o_st
Printer status variable
Specify the variable in which the printer status is stored.
Return value
On success: Returns 0. On failure: Returns an error code. See "Error Code List" for details of the error code.
Remarks
- When a callback function is registered by this API, the callback function is called with the current printer status.
- Even when the printer status is received, the callback function will not be called when the printer status has not changed from when it was last received.
- When reconnection to the printer is detected, the printer status is the status received last at the time
- When this API is called in the state that the callback function is registered, the already registered function becomes disabled, and a new callback function is registered.
- Even when this API is called specifying the already registered and enabled callback function again, the printer status response immediately after it is performed.
- The callback function registered by this API is unregistered by the following APIs:
- CloseMonPrinter
- CancelStatusBack
- The following APIs cannot be called from the registered callback function with the same API handle:
- CloseMonPrinter
- SetStatusBackFunction
- SetStatusBackWnd
- CancelStatusBack
- The return value of the callback function is ignored.
- The time from receiving the printer status until calling the callback function is not guaranteed.
- See "Printer Status List" for details of the printer status.