SplIsSessionZero function

The SplIsSessionZero function determines whether a certain print job (print handle plus job ID) was issued in session zero.


DWORD SplIsSessionZero(
  HANDLE hPrinter,
  DWORD  JobId,
  BOOL   *pIsSessionZero



Is a handle to the printer.




Pointer to a memory location that is set to TRUE if the SessionID for the session is zero; otherwise, this value is set to FALSE.

Return Value

On success, the SplIsSessionZero function returns ERROR_SUCCESS; otherwise this function returns a Win32 error code.


A driver that displays custom user interface elements can use the SplIsSessionZero function to determine whether the current job was issued in session 0. Such a driver can use this information to enable it to present user interface elements in the user's session, rather than in session zero. A related function, SplPromptUIInUsersSession, displays a standard Windows message box in the user's session.

If you plan to use this function in a driver intended to run under Windows 2000, you must load spoolss.dll by a call to the LoadLibrary function, and then find the address of this function within that DLL by a call to the GetProcAddress function. (LoadLibrary and GetProcAddress are described in the Microsoft Windows SDK documentation.) If the call to GetProcAddress fails, you must use an alternative mechanism to display user interface elements.


Windows version This function is available in Windows XP and later.
Target Platform Desktop
Header winsplp.h (include Winsplp.h)
Library Spoolss.lib
DLL Spoolss.dll

See Also