SetSessionID

#include “BlackIceDEVMODE.h”

 

BOOL SetSessionID(BlackIceDEVMODE* pBlackIceDevMode, DWORD dwSessionID)

Description

Sets the session ID stored in the DEVMODE of the printer driver. This session ID will be used in the message interface name on terminal servers. For example \\.\pipe\ColorMessageInterface2. The 2 is the used session ID.

This value is ignored if the UseWindowsSessionID property is set to TRUE.

Parameters

BlackIceDEVMODE* pBlackIceDevMode           - pointer to the BlackIceDEVMODE structure

DWORD dwSessionID                                           - session ID to set. This value must be a positive integer value.

Return value

TRUE on success, otherwise FALSE

Programming Notes

Only used on Windows Server systems.

This function can be used to specify the session ID manually. This is for advanced users only. Changing this value is not recommended unless it is your application that does the printing and you can guarantee that your application is using a DEVMODE structure that contains the updated value (I.e.: you print using GDI from C++ and you change this value directly in the DEVMODE structure that is used throughout your application and passed into CreateDC). By setting the session ID to a unique value in your application you can restrict the messaging interface so you only receive messages about print jobs that where printed from your application.

If you want to make sure every application is using the same value, you should change the SessionID and UseWindowsSessionID keys in the printer driver INI files before installation.

Code Example

None