#include "ltdic.h"
L_INT LDicomPrintSCU::GetPrinterConfiguration()
Queries the Print SCP for the printer configuration information.
Value | Meaning |
---|---|
0 | The printer configuration information was retrieved successfully. |
DICOM_ERROR_PRINTSCU_FAILURE_STATUS | The response of the Print SCP specifies a Failure status code. |
DICOM_ERROR_PRINTSCU_CLASS_NOT_SUPPORTED | The Printer Configuration Retrieval SOP Class is not supported on the Association. |
> 0 | An error occurred. Refer to Return Codes. |
The function will not return until it receives the response of the Print SCP, or an error occurs. The function LDicomPrintSCU::GetLastOperationStatus can be used to obtain the status code specified in the response of the Print SCP. When the return value of the function GetPrinterConfiguration is 0, then the printer configuration information was retrieved successfully, with either a Success or Warning status code in the response of the Print SCP.
The retrieved printer configuration information is stored in the data member LDicomPrintSCU::m_PrinterConfiguration, which is an LDicomDS object.
Required DLLs and Libraries
Win32, x64
L_INT LDicomPrintSCU_GetPrinterConfigurationExample(LDicomPrintSCU& PrintSCU)
{
L_INT nRet;
// Assume that the Association is already established
// Query the Print SCP for the printer configuration information
nRet = PrintSCU.GetPrinterConfiguration ();
if(nRet != DICOM_SUCCESS)
return nRet;
else
{
// We will display only the Printer Name and Memory Bit Depth
// in the first Item
LDicomDS& PrnConfig = PrintSCU.m_PrinterConfiguration;
pDICOMELEMENT pElement;
L_TCHAR szPrnConfigInfo[128];
pElement = PrnConfig.FindFirstElement (NULL,
TAG_PRINTER_CONFIGURATION_SEQUENCE,
FALSE);
if (!pElement)
return -1;
pElement = PrnConfig.GetChildElement (pElement, TRUE);
if (!pElement)
return -1;
pElement = PrnConfig.GetChildElement (pElement, TRUE);
if (!pElement)
return -1;
wsprintf(szPrnConfigInfo, TEXT("Printer Name: "));
pDICOMELEMENT pPrinterName;
pPrinterName = PrnConfig.FindFirstElement (pElement,
TAG_PRINTER_NAME,
TRUE);
if (pPrinterName)
{
L_TCHAR* pszPrinterName = PrnConfig.GetStringValue (pPrinterName, 0, 1);
if (pszPrinterName)
{
wsprintf(szPrnConfigInfo, TEXT("%s%s"), szPrnConfigInfo, pszPrinterName);
}
}
wsprintf(szPrnConfigInfo, TEXT("%s\nMemory Bit Depth: "), szPrnConfigInfo);
pDICOMELEMENT pMemoryBitDepth;
pMemoryBitDepth = PrnConfig.FindFirstElement (pElement,
TAG_MEMORY_BIT_DEPTH,
TRUE);
if (pMemoryBitDepth)
{
L_INT16* pnMemoryBitDepth = PrnConfig.GetShortValue(pMemoryBitDepth,
0,
1);
if (pnMemoryBitDepth)
{
wsprintf(szPrnConfigInfo, TEXT("%s%hu"),
szPrnConfigInfo, *pnMemoryBitDepth);
}
}
MessageBox(NULL, szPrnConfigInfo, TEXT("Printer Config Info"), MB_OK);
}
return DICOM_SUCCESS;
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document