SplGetPortFromQ
Appearance
This function gets a list of ports connected to the print queue for the print object or applications. This function is used by the print object to determine if some menu items can be enabled based on the type of printer port connected to a print queue.
Syntax
SplGetPortFromQ(pszComputerName, pszQueueName, ulLevel, pBuf, cbBuf, pcbNeeded);
Parameters
- pszComputerName (PSZ) - input
- Name of the computer on which pszQueueName exists.
- This value is NULL if the queue is local or if the queue references a network print queue.
- pszQueueName (PSZ) - input
- Name of print queue.
- This is the print queue name on pszComputerName or a local print queue name that may reference a network print queue.
- ulLevel (ULONG) - input
- Level of information to return.
- Only level 1 is supported, which returns the GETPORTFROMQ data structure. See GETPORTFROMQ in Data Types for details on this data structure.
- pBuf (PVOID) - output
- Receives the GETPORTFROMQ data structure.
- cbBuf (ULONG) - input
- Length of buffer pointed to by pBuf, in bytes.
- pcbNeeded (ULONG) - output
- Receives length, in bytes, of buffer needed to return all port data.
Returns
- rc (ULONG) - returns
- Return codes.
- 0 Success
- ERROR_BAD_NET_NAME(67)
- The computer name cannot be found.
- ERROR_BAD_NETPATH(53)
- The computer name specified is not available or is invalid.
- ERROR_INVALID_LEVEL(124)
- ulLevel is not 1.
- ERROR_INVALID_PARAMETER(87)
- An invalid parameter was specified; most likely an invalid pBuf value.
- ERROR_MORE_DATA(234)
- Not all data could fit in pBuf.
- ERROR_NOT_SUPPORTED(50)
- Command not supported on pszComputerName.
- NERR_BufTooSmall(2123)
- No data could fit in pBuf.
- NERR_QNotFound(2150)
- The queue name does not exist.
Sample
#define INCL_SPL #define INCL_SPLBIDI #include <os2.h> PSZ pszComputerName; /* Name of the computer on which pszQueueName exists. */ PSZ pszQueueName; /* Name of print queue. */ ULONG ulLevel; /* Level of information to return. */ PVOID pBuf; /* Receives the GETPORTFROMQ data structure. */ ULONG cbBuf; /* Length of buffer pointed to by pBuf, in bytes. */ ULONG pcbNeeded; /* Receives length, in bytes, of buffer needed to return all port data. */ ULONG rc; /* Return codes. */ rc = SplGetPortFromQ(pszComputerName, pszQueueName, ulLevel, pBuf, cbBuf, pcbNeeded);