The BLACKICE_MESSAGE_DEVMODE message

 

The Black Ice printer driver sends the BLACKICE_MESSAGE_DEVMODE message to the application before the BLACKICE_MESSAGE_STARTDOC  message and before each BLACKICE_MESSAGE_STARTPAGE message.

 

The application can modify the printer driver Extended devmode structure to configure the printer driver. The Application can NOT modify certain members of the printer driver DEVMODE structure such as Resolution (DPI), Orientation and Paper Size. If the application wants to change a member of the DEVMODE structure, the application should change that member at every BLACKICE_MESSAGE_DEVMODE message, because the application receives a different instance of the DEVMODE structure every time and different members of the DEVMODE structure are read by the driver at different stages of the printing process.

 

Parameters:

 

wParam:

A handle to the TSPrnMessage structure. Use the GlobalLock WinAPI function to get a  pointer to a TSPrnMessage structure:

 

TSPrnMessage* pPrnMsg = (TSPrnMessage*)GlobalLock((HGLOBAL)wParam);

 

If you do not need the TSPrnMessage structure anymore, free it using the GlobalUnlock and GlobalFree functions:

 

GlobalUnlock((HGLOBAL)wParam);

GlobalFree((HGLOBAL)wParam);

 

The definition of the TSPrnStructure is available on the following page: http://www.blackice.com/private/rtk/The_Message_Capture_Library_Reference.htm

 

For printer drivers 14.97 and earlier, the valid members of the TSPrnMessage structure for the “BLACKICE_MESSAGE_DEVMODE” messages is the dwMessage .

 

For printer drivers 14.98 and newer, the valid members of the TSPrnMessage structure for the “BLACKICE_MESSAGE_DEVMODE” messages are the dwMessage, szDocName, szPrinterName, dwJobID fields of the TSPrnMessage structure.

 

lParam:

A pointer to the BlackIceDEVMODE structure:

 

BlackIceDEVMODE* pDevMode = (BlackIceDEVMODE*)lParam;

Do not free this pointer.

 

 

Notes for using the Start Application feature with the BLACKICE_MESSAGE_DEVMODE message:

 

If the application is started by the Printer Driver’s “Start Application Before Printing” feature, it  is started at the BLACKICE_MESSAGE_STARTDOC event and the printer driver will not wait for the application. This means the application will not receive the first BLACKICE_MESSAGE_DEVMODE message, and depending on how fast it starts and how fast the printing progresses, it might not receive any messages at all.

 

Therefore if one wants to use the Messaging Interface from an application started by the printer driver, the application must be started using the “Start for Messaging” option or must run in the background and wait for the events continuously instead of being started by the Printer Driver. Another option is to use the plugin interface (BiPlugin.dll) instead of the Messaging Interface. (Especially when changing settings like file type and output directory or filename, which must be set at the first time the BLACKICE_MESSAGE_DEVMODE event fires)

 

To make the Printer Driver wait for the application at every event or to abort the printing process, the plugin interface must be used.

The Save As dialog pops up before the message capture application gets the BLACKICE_MESSAGE_DEVMODE message, therefore the Save As dialog can’t be enabled or disabled in the handler of the BLACKICE_MESSAGE_DEVMODE messages.

To disable the Save As dialog when the message capture application is running, the DisableSaveAsOption function of the BlackIceDEVMODE DLL or OCX control should be called when the application starts and the EnableSaveAsOption function should be called when the application closes. In this case when the application is running the Save As dialog won’t pop up at printings.