DeviceCapabilities(DC_BINNAMES) Data Format

Last reviewed: January 5, 1995
Article ID: Q82167
The information in this article applies to:
  • Microsoft Windows Software Development Kit (SDK) for Windows version 3.1

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
KBCategory: kbprg
KBSubcategory: GdiPrn


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: January 5, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.