Using the Messaging Interface

 

Beginning with Printer Drivers Version 14.04, the Messaging Interface in the desktop (Windows 11, 10, 8, 7) version of the printer drivers have been modified to work similarly to the Server version of the Printer Drivers. A Messaging Interface ID is now used by the Driver to allow greater control in multi-user environments. By default, the Driver is configured to use the User’s Windows Session ID as the Messaging Interface ID. When using the Messaging Interface in an application, the application must specify the Messaging Interface ID it wants to receive messages from.

 

To ensure the compatibility with the latest Printer Drivers, the following modifications have to be made to existing applications that use the Message Capture DLL:

 

The WaitForPrnPipe function is used to start the Message Capture. To ensure the compatibility with the latest Printer Drivers, the Messaging Interface ID must be concatenated to the Messaging Interface Name, before passing the Messaging Interface Name to the WaitForPrnPipe function.

 

Example for C++ sample:

 

Original source code:

                // Create the message interface name

                TCHAR szPipeName[MAX_PATH];

                _stprintf(szPipeName, _T("\\\\.\\pipe\\%s"), GetInterfaceName(lpDevMode));

 

                // Start to receive printer driver messages

                WaitForPrnPipe(szPipeName, hDlg, WM_USER + 1000);

 

New source code should be:

                // Create the message interface name

                TCHAR szPipeName[MAX_PATH];

                _stprintf(szPipeName, _T("\\\\.\\pipe\\%s%d"), GetInterfaceName(lpDevMode), GetSessionID(lpDevMode));

 

                // Start to receive printer driver messages

                WaitForPrnPipe(szPipeName, hDlg, WM_USER + 1000);

 

Also, to ensure the compatibility with the latest Printer Drivers, the following modifications have to be made to existing applications that use the Message Capture ActiveX Control:

 

The StartCapture method is used to start the Message Capture. To ensure the compatibility with the latest Printer Drivers, the Messaging Interface ID must be set in the BiPrnDrv object, before calling the StartCapture method.

 

Example for C# sample:

 

Original source code:

                // Start to receive printer driver messages

BiPrnDrv.StartCapture(szPrinterName, 3);

 

New source code should be:

                // Get the Session ID used by the driver and pass it to the BiPrnDrv object

int iDevmode = BlackIceDEVMODE.LoadBlackIceDEVMODE(szPrinterName);

BiPrnDrv.SessionID = BlackIceDEVMODE.GetSessionID(iDevmode);

BlackIceDEVMODE.ReleaseBlackIceDEVMODE(iDevmode);

               

// Start to receive printer driver messages

BiPrnDrv.StartCapture(szPrinterName, 3);

 

Example for VB.NET sample:

 

Original source code:

'Start to receive printer driver messages

BiPrnDrv.StartCapture(szPrinterName, 3)

 

New source code should be:

'Get the Session ID used by the driver and pass it to the BiPrnDrv object

Dim iDevmode As Integer = BlackIceDEVMODE.LoadBlackIceDEVMODE(szPrinterName)

BiPrnDrv.SessionID = BlackIceDEVMODE.GetSessionID(iDevmode)

BlackIceDEVMODE.ReleaseBlackIceDEVMODE(iDevmode)

 

'Start to receive printer driver messages

BiPrnDrv.StartCapture(szPrinterName, 3)

              

By default, the Driver is configured to use the User’s Windows Session ID as the Messaging Interface ID, therefore the notified application receives the messages from only the current User’s session. This configuration is recommended in most cases.

 

Optionally, to receive messages from all Windows Sessions in a single application, the UseWindowsSessionID flag Printer Driver INI file must be reconfigured as the following

 

Original INI file setting

UseWindowsSessionID=Yes

 

New INI file setting should be the following:

UseWindowsSessionID=No

 

The Printer Driver INI file locations are the following (both INI file must be modified):

 

On 32 bit operating systems

C:\Windows\System32\Spool\Drivers\w32x86

C:\Windows\System32\Spool\Drivers\w32x86\3       

  

On 64 bit operating systems

C:\Windows\System32\spool\drivers\x64

C:\Windows\System32\spool\drivers\x64\3

 

The Printer Driver INI file names are the following for the different type of printer drivers:

 

BuCiniNT.ini             - for the Color driver

BuAiniNT.ini             - for the ColorPlus driver

BuEIniNT.ini             - for the EMF (metafile) driver

BuMIniNT.ini            - for the TIFF (monochrome) driver

BuPIniNT.ini             - for the PDF driver

BuCIniTS.ini             - for the Color Terminal Server driver

BuAIniTS.ini             - for the ColorPlus Terminal Server driver

BuEIniTS.ini             - for the EMF Terminal Server driver

BuMIniTS.ini             - for the TIFF Terminal Server driver

BuPIniTS.ini             - for the PDF Terminal Server driver

 

NOTE: In case of Demo OEM Printer Drivers the INI file names are different. The NT is replaced with ND, and the TS is replaced with TD. For example in case of ColorPlus OEM Demo: BuAiniND.ini for Desktop, and BuAiniTD.ini for Server.

 

To take effect the INI file changes click on the “Restore defaults” button on the bottom of the “Device Settings” Tab of the printer driver and please restart the application you are printing from.