SendCFindResponse Example for C++ 6.0 and later
void CDicomNetSink::OnNetReceiveCFindRequest( long hNet, short nPresentationID, short nMessageID, LPCTSTR pszClass, short nPriority, long hDS )
{
//The Server receives a C-Find request and sends several C-Find Responses to the client
//
//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);
strMsg.Format("*** OnNetReceiveCFindRequest ***\nPeer[%s]\nnPresentationID[%d]\nnMessageID[%d]\npszClass[%s]\nnPriority[%d]\nhDS[%x]\n",
(char *)strPeerAddress,
nPresentationID,
nMessageID,
pszClass,
nPriority,
hDS);
//Load each file and send it to the calling AE
//For this example, assume the following two files match the find criteria
//load sample file 1
m_pDlg->m_pLEADDicomDS->LoadDS ("e:\\images\\dicom16.dic", 0);
//send a Find Response - PENDING
strMsg=strMsg + "SendCFindResponse\n";
m_pDlg->m_pLEADDicomNet->SendCFindResponse ( hNet,
nPresentationID,
nMessageID,
pszClass,
COMMAND_STATUS_PENDING,
m_pDlg->m_pLEADDicomDS->GethDicomDS()
);
//load sample file 2
m_pDlg->m_pLEADDicomDS2->LoadDS ("e:\\images\\test.dic", 0);
strMsg=strMsg + "SendCFindResponse\n";
//send a Find Response - PENDING
m_pDlg->m_pLEADDicomNet->SendCFindResponse (
hNet,
nPresentationID,
nMessageID,
pszClass,
COMMAND_STATUS_PENDING,
m_pDlg->m_pLEADDicomDS->GethDicomDS()
);
strMsg=strMsg + "SendCFindResponse\n";
//now, send a Find Response - SUCCESS
m_pDlg->m_pLEADDicomNet->SendCFindResponse (hNet, nPresentationID, nMessageID, pszClass, COMMAND_STATUS_SUCCESS, 0);
AfxMessageBox(strMsg);
}