EnumMonitors

The EnumMonitors function initializes an array of structures with data describing the monitors for the specified server.

BOOL EnumMonitors(
  LPTSTR pName,       // pointer to server name
  DWORD Level,        // structure level
  LPBYTE pMonitors,   // pointer to structure array
  DWORD cbBuf,        // size, in bytes, of buffer
  LPDWORD pcbNeeded,  // addr. of variable with no. of bytes copied 
                      // (or required)
  LPDWORD pcReturned  // addr. of variable with no. of job info. 
                      // structures copied
);
 

Parameters

pName
Pointer to a null-terminated string that specifies the name of the server on which the monitors reside. If this parameter is NULL, the local monitors are enumerated.
Level
Specifies the version of the structure pointed to by pMonitors.

Windows NT: This value can be 1 or 2.

Windows 95, Windows 98: This value must be 1.

PMonitors
Pointer to a buffer that receives an array of structures. The buffer must be large enough to store the strings referenced by the structure members.

Windows NT: The buffer receives an array of MONITOR_INFO_1 structures if Level is 1, or MONITOR_INFO_2 structures if Level is 2.

Windows 95, Windows 98: The buffer receives an array of MONITOR_INFO_1 structures if Level is 1.

cbBuf
Specifies the size, in bytes, of the buffer pointed to by pMonitors.
pcbNeeded
Pointer to a variable that receives the number of bytes copied if the function succeeds or the number of bytes required if cbBuf is too small.
pcReturned
Pointer to a variable that receives the number of structures that were returned in the buffer pointed to by pMonitors.

Return Values

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

QuickInfo

  Windows NT: Requires version 3.1 or later.
  Windows: Requires Windows 95 or later.
  Windows CE: Unsupported.
  Header: Declared in winspool.h.
  Import Library: Use winspool.lib.
  Unicode: Implemented as Unicode and ANSI versions on Windows NT.

See Also

Printing and Print Spooler Overview, Printing and Print Spooler Functions, MONITOR_INFO_1, MONITOR_INFO_2