Getting Printer Information Example for C++ 6.0 and later

void GetPrinterInfo(ILPrinterPtr& spPrinter)
{
   // Assume that the Association is already established

   // We need only the Printer Status and Printer Status Info
   spPrinter->RequiredInfo = PrinterInfoAttribEnum(PRN_PRINTER_STATUS +
                                                   PRN_PRINTER_STATUS_INFO);

   // Query the Print SCP for the information
   if (spPrinter->GetInfo(VARIANT_TRUE, VARIANT_FALSE) == DICOM_SUCCESS)
   {
      // Display the retrieved information

      char szPrinterInfo[256];
      wsprintf(szPrinterInfo, "Printer Status: %s\nPrinter Status Info: %s",
               LPCSTR(spPrinter->PrinterStatus),
               LPCSTR(spPrinter->PrinterStatusInfo));

      MessageBox(NULL, szPrinterInfo, "Printer Info", MB_OK);
   }
}