// DicomDSSink.cpp : implementation file // #include "stdafx.h" // #include "dicom.h" #include "DicomDSSink.h" // #include "DICOMDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CDicomDSSink IMPLEMENT_DYNCREATE(CDicomDSSink, CCmdTarget) CDicomDSSink::CDicomDSSink() { EnableAutomation(); } CDicomDSSink::~CDicomDSSink() { } void CDicomDSSink::OnFinalRelease() { // When the last reference for an automation object is released // OnFinalRelease is called. The base class will automatically // deletes the object. Add additional cleanup required for your // object before calling the base class. CCmdTarget::OnFinalRelease(); } BEGIN_MESSAGE_MAP(CDicomDSSink, CCmdTarget) //{{AFX_MSG_MAP(CDicomDSSink) // NOTE - the ClassWizard will add and remove mapping macros here. //}}AFX_MSG_MAP END_MESSAGE_MAP() BEGIN_DISPATCH_MAP(CDicomDSSink, CCmdTarget) //{{AFX_DISPATCH_MAP(CDicomDSSink) // NOTE - the ClassWizard will add and remove mapping macros here. DISP_FUNCTION_ID(CDicomDSSink,"ConformanceStatus",1,OnConformanceStatus,VT_EMPTY,VTS_I2) DISP_FUNCTION_ID(CDicomDSSink,"ProgressStatus",2,OnProgressStatus,VT_EMPTY,VTS_I2) //}}AFX_DISPATCH_MAP END_DISPATCH_MAP() // Note: we add support for IID_IDicomDSSink to support typesafe binding // from VBA. This IID must match the GUID that is attached to the // dispinterface in the .ODL file. // {F017365A-F53F-43F8-8C8E-B6617E7C3CE8} static const IID IID_IDicomDSSink = { 0xf017365a, 0xf53f, 0x43f8, { 0x8c, 0x8e, 0xb6, 0x61, 0x7e, 0x7c, 0x3c, 0xe8 } }; BEGIN_INTERFACE_MAP(CDicomDSSink, CCmdTarget) INTERFACE_PART(CDicomDSSink, DIID__LEADDicomDSEvents, Dispatch) END_INTERFACE_MAP() ///////////////////////////////////////////////////////////////////////////// // CDicomDSSink message handlers void CDicomDSSink::OnConformanceStatus(short nFlags) { CString msg; short nRet; CString szTag; CString szOut; IDicomDSElementPtr pCurrentElement=NULL; //display info about non-standard element switch(nFlags) { case CALLBACK_ERROR_UNKNOWN_CLASS: msg = "Unknown Class"; break; case CALLBACK_ERROR_UNKNOWN_TAG: msg = "Unknown Tag"; break; case CALLBACK_ERROR_UNKNOWN_VR: msg = "Unknown VR"; break; case CALLBACK_ERROR_WRONG_VR: msg = "Error in VR"; break; case CALLBACK_ERROR_MIN_VM: msg = "Error in MinVM"; break; case CALLBACK_ERROR_MAX_VM: msg = "Error in MaxVM"; break; case CALLBACK_ERROR_DIVIDE_VM: msg = "Error in DivideVM"; break; case CALLBACK_ERROR_IMAGE: msg = "Error in Image"; break; default: return; } pCurrentElement = m_pDlg->m_pLEADDicomDS->GetCurrentElement(); szTag.Format("%04X:%04X", GETGROUP(pCurrentElement->GetTag()), GETELEMENT(pCurrentElement->GetTag())); szOut.Format("%s\nTag: %s", msg, szTag); nRet = m_pDlg->MessageBox(szOut, "Non-Standard Element", MB_OKCANCEL); if(nRet == IDCANCEL) m_pDlg->m_pLEADDicomDS->EnableConformanceStatus = FALSE; return; } void CDicomDSSink::OnProgressStatus(short nPercent) { MSG msg; CString szStatus; // are there any messages in the queue (like a button being pressed) ? while( PeekMessage(&msg,NULL, 0, 0, PM_REMOVE) ) { TranslateMessage( &msg ); /* Translates virtual key codes. */ DispatchMessage( &msg ); /* Dispatches message to window. */ } if( !m_pDlg->m_bQuit ) // Look for the Click on the LEAD Control to Quit { szStatus.Format("Loading...%d%%", nPercent); m_pDlg->SetWindowText(szStatus); } else m_pDlg->m_pLEADDicomDS->EnableProgressEvent = FALSE; // Cancel the task }