Getting Printer Configuration Information Example for C++ 6.0 and later

void GetPrinterConfigInfo(ILPrinterConfigurationPtr& spPrnConfig)
{
   // Assume that the Association is already established

   // Query the Print SCP for the printer configuration information
   if (spPrnConfig->Get() == DICOM_SUCCESS)
   {
      // We will display only the Attributes of the first Printer Configuration Item

      if (spPrnConfig->PrinterConfigItems->Count > 0)
      {
         ILAttributesPtr spAttributes;
         spAttributes = spPrnConfig->PrinterConfigItems->Item(0)->Attributes;
         char szPrnConfigInfo[1024] = "";

         long lAttribsCount = spAttributes->Count;
         for (long i = 0; i < lAttribsCount; i++)
         {
            wsprintf(szPrnConfigInfo, "%s%s: %s\n",
                     szPrnConfigInfo,
                     LPCSTR(spAttributes->Item(i)->Name),
                     LPCSTR(spAttributes->Item(i)->Value));
         }

         MessageBox(NULL, szPrnConfigInfo, "Printer Config Info", MB_OK);
       }
   }
}