DeviceCapabilities(DC_BINNAMES) Data FormatLast reviewed: January 5, 1995Article ID: Q82167 |
The information in this article applies to:
When an application calls the DeviceCapabilities() API with the nIndex parameter set to DC_BINNAMES, 24 bytes are required for each bin name. DeviceCapabilities() returns the name of each bin as a null-terminated string in a character array. Each bin-name entry requires 24 bytes and begins on the [(n-1) * 24] byte of the array. The following code demonstrates how to allocate a block of memory, retrieve the bin names, and walk through the array of bin names. The code assumes that GetProcAddress() has been used to retrieve a long pointer to the DeviceCapabilities() in the printer driver and that the pointer was stored in the lpfnDevCap variable:
if ((dwDMSize = (*lpfnDevCap)(lpszDevice, lpszPort, DC_BINNAMES, 0L, lpDevMode)) && (dwDMSize != (DWORD)(-1))) { if (hMem = GlobalAlloc(GMEM_MOVEABLE, (WORD)dwDMSize * 24)) { lpMem = (LPINT)GlobalLock(hMem); nBins = (WORD)(*lpfnDevCap)(lpszDevice, lpszPort, DC_BINNAMES, lpMem, lpDevMode); for (lpBins = lpMem, i = 0; i < nBins; i++, lpBins += 24) { // lpBins points to the null-terminated bin name. } GlobalUnlock(hMem); GlobalFree(hMem); } } |
Additional reference words: 3.10
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |