SendCEchoRequest Example for C++ 6.0 and later
{
//This example sends a C-Echo Request to a server
//
//In this example:
//1. m_Dicom, m_Dicom2 are LEAD ActiveX Dicom objects (CLEADDICOM)
//
//2. m_DicomNet is LEAD ActiveX DicomNet object (CLEADDICOMNet)
//
//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 = "C-Echo Request\n";
_bstr_t strUID = UID_VERIFICATION_CLASS;
long hNet = m_pLEADDicomNet->GethNet();
long hPDU = m_pLEADDicomNet->GetAssociate (hNet);
short nPresentationID = m_pLEADDicomNet->FindPresentationAbstract (hPDU, strUID);
//nPresentationID must be odd--if 0, indicates failure
if (nPresentationID==0)
{
CString strTmp;
strTmp.Format("Abstract Syntax[%s] Not Included in the Association", UID_VERIFICATION_CLASS);
strMsg = strMsg + strTmp;
}
else
//success
{
short nUniqueID = 99;
m_pLEADDicomNet->SendCEchoRequest (
hNet,
nPresentationID,
nUniqueID,
UID_VERIFICATION_CLASS);
}
AfxMessageBox(strMsg);
}