The EnumPrinterData function enumerates configuration data for a specified printer.
A printer’s configuration data consists of a set of named and typed values. The EnumPrinterData function obtains one of these values, and its name and a type code, each time you call it. Call the EnumPrinterData function several times in succession to obtain all of a printer’s configuration data values.
Printer configuration data is stored in the registry. While enumerating printer configuration data, you should avoid calling registry functions that might change that data.
DWORD EnumPrinterData(
HANDLE hPrinter, |
// handle to printer of interest |
DWORD dwIndex, |
// index of value to retrieve |
LPTSTR pValueName, |
// pointer to buffer to receive value name |
DWORD cbValueName, |
// size in bytes of value name buffer |
LPDWORD pcbValueName, |
// pointer to variable to receive number of bytes stored into value name buffer |
LPDWORD pType, |
// pointer to variable to receive value type code |
LPBYTE pData, |
// pointer to buffer to receive value data |
DWORD cbData, |
// size in bytes of value data buffer |
LPDWORD pcbData |
// pointer to variable to receive number of bytes stored into value data buffer |
); |
You obtain this printer handle by calling the OpenPrinter function.
Set this parameter to zero for the first call to EnumPrinterData for a given printer handle. Then increment the parameter by one for subsequent calls involving the same printer, until the function returns ERROR_NO_MORE_ITEMS. See the following Remarks section for further information.
Note: If you use the technique mentioned in the descriptions of the cbValueName and cbData parameters to obtain adequate buffer size values, setting both those parameters to zero in a first call to EnumPrinterData for a given printer handle, the value of dwIndex does not matter for that call. Set dwIndex to zero in the next call to EnumPrinterData to start the actual enumeration process.
Configuration data values are not ordered. New values will have an arbitrary
index. This means that the EnumPrinterData function may return values
in any order.
If you want to have the operating system supply an adequate buffer size, set
both this parameter and the cbData parameter to zero for the first call
to EnumPrinterData for a given printer handle. When the function
returns, the variable pointed to by pcbValueName will contain a buffer
size that is large enough to successfully enumerate all of the printer’s
configuration data value names.
Value |
Meaning |
REG_BINARY |
Binary data in any form. |
REG_DWORD |
A 32-bit number. |
REG_DWORD_LITTLE_ENDIAN |
A 32-bit number in little-endian format. This is equivalent to REG_DWORD. In little-endian format, a multi-byte value is stored in memory from the lowest byte (the “little end”) to the highest byte. For example, the value 0x12345678 is stored as (0x78 0x56 0x34 0x12) in little-endian format. Windows NT and Windows 95 are designed to run on little-endian computer architectures. A user may connect to computers that have big-endian architectures, such as some UNIX systems. |
REG_DWORD_BIG_ENDIAN |
A 32-bit number in big-endian format. In big-endian format, a multi-byte value is stored in memory from the highest byte (the “big end”) to the lowest byte. For example, the value 0x12345678 is stored as (0x12 0x34 0x56 0x78) in big-endian format. Windows NT and Windows 95 are designed to run on little-endian computer architectures. A user may connect to computers that have big-endian architectures, such as some UNIX systems. |
REG_EXPAND_SZ |
A null-terminated string that contains unexpanded references to environment variables (for example, “%PATH%”). It will be a Unicode or ANSI string depending on whether you use the Unicode or ANSI functions. |
REG_LINK |
A Unicode symbolic link. |
REG_MULTI_SZ |
An array of null-terminated strings, terminated by two null characters. |
REG_NONE |
No defined value type. |
REG_RESOURCE_LIST |
A device-driver resource list. |
REG_SZ |
A null-terminated string. It will be a Unicode or ANSI string, depending on whether you use the Unicode or ANSI functions. |
The pType parameter can be NULL if the type code is not required.
This parameter can be NULL if the configuration data value is not required.
If you want to have the operating system supply an adequate buffer size, set
both this parameter and the cbValueName parameter to zero for the first
call to EnumPrinterData for a given printer handle. When the function
returns, the variable pointed to by pcbData will contain a buffer size
that is large enough to successfully enumerate all of the printer’s
configuration data value names.
This parameter can be NULL if pData is NULL.
If the function succeeds, the return value is ERROR_SUCCESS.
If the function fails, the return value is a Win32 error value.
The function returns ERROR_NO_MORE_ITEMS when there are no more configuration data values to retrieve for a given printer handle.
EnumPrinterData retrieves printer configuration data set by the SetPrinterData function.
If you want to have the operating system supply an adequate buffer size, first call EnumPrinterData with both the cbValueName and cbData parameters set to zero, as noted earlier in the Parameters section. The value of dwIndex does not matter for this call. When the function returns, *pcbValueName and *pcbData will contain buffer sizes that are large enough to enumerate all of the printer’s configuration data value names and values. On the next call, allocate value name and data buffers, set cbValueName and cbData to the sizes in bytes of the allocated buffers, and set dwIndex to zero. Thereafter, continue to call the EnumPrinterData function, incrementing dwIndex by one each time, until the function returns ERROR_NO_MORE_ITEMS.
DeletePrinterData, GetPrinterData, OpenPrinter, SetPrinter, SetPrinterData
file: /Techref/os/win/api/win32/func/src/f21_2.htm, 11KB, , updated: 2000/4/7 11:19, local time: 2024/11/23 22:28,
18.226.93.138:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://massmind.org/Techref/os/win/api/win32/func/src/f21_2.htm"> EnumPrinterData</A> |
Did you find what you needed? |
Welcome to massmind.org! |
Welcome to massmind.org! |
.