NetReceiveCFindResponse Example for C++ 6.0 and later
void CDicomNetSink::OnNetReceiveCFindResponse(long hNet, short nPresentationID, short nMessageID, LPCTSTR pszClass, long nStatus, long hDS)
{
//In this example, the Client receives several C-Find responses from the Server
//
//In this example:
//1. m_LEADRasterView1, m_LEADRasterView2 are LEAD ActiveX Raster View (CLEADRasterView)
//
//2. m_pLEADDicomNet is LEAD DicomNet COM object (ILEADDicomNet *m_pLEADDicomNet)
//
//3. m_nClientOrServer: can be (STATUS_NONE, STATUS_SERVER, STATUS_CLIENT)
// identifieds the LMyDicomNet object as a server or a client
//4. m_nDataCommand: can be (COMMAND_C_MOVE,COMMAND_C_GET)
// set so the server knows how a C-Store Response was generated
//
//5. A connection exists between client and server
//6. An association exists between the client and server
CString strMsg;
_bstr_t strPeerAddress = m_pDlg->m_pLEADDicomNet->GetPeerAddress (hNet);
CString strStatus;
strStatus.Format("%d", nStatus);
switch(nStatus)
{
case COMMAND_STATUS_PENDING:
strStatus = "COMMAND_STATUS_PENDING";
break;
case COMMAND_STATUS_SUCCESS:
strStatus = "COMMAND_STATUS_SUCCESS";
break;
case COMMAND_STATUS_CANCEL:
strStatus = "COMMAND_STATUS_CANCEL";
break;
}
strMsg.Format("*** OnNetReceiveCFindResponse ***\nPeer[%s]\nnPresentationID[%d]\nnMessageID[%d]\npszClass[%s]\nstrStatus[%s]\npDS[%x]",
(char *)strPeerAddress,
nPresentationID,
nMessageID,
pszClass,
strStatus,
hDS);
//save the data set to disk
if (hDS != 0)
{
m_pDlg->m_FileCount++;
CString strFileName;
strFileName.Format("d:\\temp\\CFind%d.dic", m_pDlg->m_FileCount);
_bstr_t sFileName = strFileName;
m_pDlg->m_pLEADDicomDS2->SaveExtDS(hDS, sFileName,0);
strMsg = strMsg + "Saving[" + strFileName + "]";
}
AfxMessageBox(strMsg);
}