NetReceiveCMoveRequest Example for C++ 6.0 and later
void CDicomNetSink::OnNetReceiveCMoveRequest(long hNet, short nPresentationID, short nMessageID, LPCTSTR pszClass, short nPriority, LPCTSTR pszMoveAE, long hDS)
{
//The Server receives a C-Move request and sends a C-Store request 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("*** OnNetReceiveCMoveRequest ***\nPeer[%s]\nnPresentationID[%d]\nnMessageID[%d]\npszClass[%s]\nnPriority[%d]\npszMoveAE[%s]\nhDS[%x]\n",
(char *)strPeerAddress,
nPresentationID,
nMessageID,
pszClass,
nPriority,
pszMoveAE,
hDS
);
//The AE should check the data set, and perform
//matching against the files stored on the AE to determine
//what data set(s) should be moved to the destination AE.
//For this sample, just send a predetermined file
//load the sample file
_bstr_t strFile = "e:\\images\\dicom16.dic";
m_pDlg->m_pLEADDicomDS->LoadDS (strFile, 0);
//Find element with TAG == TAG_SOP_INSTANCE_UID
m_pDlg->m_pLEADDicomDS->MoveFirstElement (FALSE);
m_pDlg->m_pLEADDicomDS->FindFirstElement(TAG_SOP_INSTANCE_UID, FALSE);
m_pDlg->m_pLEADDicomDS->GetStringValue (0, 1);
_bstr_t strInstance = m_pDlg->m_pLEADDicomDS->GetStringValues (0);
m_pDlg->m_nDataCommand = COMMAND_C_MOVE;
//the following will cause a ReceiveCStoreResponse event on this machine
m_pDlg->m_pLEADDicomNet->SendCStoreRequest (
hNet,
nPresentationID,
nMessageID+ 1,
pszClass,
strInstance,
nPriority,
pszMoveAE,
nMessageID,
m_pDlg->m_pLEADDicomDS->GethDicomDS()
);
strMsg = strMsg + "SendCStoreRequest\n";
AfxMessageBox(strMsg);
//Server sends a CMove-Response after receiving the CStoreResponse from the calling AE
}