Getting Print Job Information Example for C++ 6.0 and later

void GetPrintJobInfo(ILPrintJobPtr& spPrintJob, _bstr_t& sPrintJobInstanceUID)
{
   // We need only the Execution Status and Execution Status Info
   spPrintJob->RequiredInfo = PrintJobInfoAttribEnum(PJ_EXECUTION_STATUS +
                                                     PJ_EXECUTION_STATUS_INFO);

   // Query the Print SCP for the Print Job information
   if (spPrintJob->GetInfo(sPrintJobInstanceUID) == DICOM_SUCCESS)
   {
      // Display the retrieved information

      char szPrintJobInfo[256];
      wsprintf(szPrintJobInfo, "Execution Status: %s\nExecution Status Info: %s",
               LPCSTR(spPrintJob->ExecutionStatus),
               LPCSTR(spPrintJob->ExecutionStatusInfo));

      MessageBox(NULL, szPrintJobInfo, "Print Job Info", MB_OK);
   }
}