SendCStoreRequest Example for C++ 6.0 and later
{
//This example sends a C-Store 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-Store\n";
//Pick a dicom file to send as the data set
m_pLEADDicomDS->LoadDS ("e:\\images\\dicom16.dic",0);
//Find element with TAG == TAG_SOP_INSTANCE_UID
m_pLEADDicomDS->MoveFirstElement (FALSE);
m_pLEADDicomDS->FindFirstElement (TAG_SOP_INSTANCE_UID, FALSE);
//Get first string in Value Field of dicom element
_bstr_t strInstanceUID = m_pLEADDicomDS->GetStringValues (m_pLEADDicomDS->GetStringValue (0,1));
m_pLEADDicomDS->FindFirstElement (TAG_SOP_CLASS_UID, FALSE);
//Get first string in Value Field of dicom element
_bstr_t strClassUID = m_pLEADDicomDS->GetStringValues (m_pLEADDicomDS->GetStringValue (0,1));
//Get the associate object
long hAssociate = m_pLEADDicomNet->GetAssociate (m_pLEADDicomNet->GethNet());
//See if class is supported in the assocation
short nPresentationID = m_pLEADDicomNet->FindPresentationAbstract (hAssociate, strClassUID);
//nPresentationID must be odd--0 indicates failure
if (nPresentationID==0)
{
CString strTmp;
strTmp.Format("Abstract Syntax[%s] Not Included in the Association", (char *)strClassUID);
strMsg = strMsg + strTmp;
}
else
{
short uUniqueID = 99;
m_FileCount = 0; //used for file name in OnReceiveCStoreRequest event
m_pLEADDicomNet->SendCStoreRequest (
m_pLEADDicomNet->GethNet(),
nPresentationID,
uUniqueID,
strClassUID,
strInstanceUID,
COMMAND_PRIORITY_MEDIUM,
"",
0,
m_pLEADDicomDS->GethDicomDS()
);
}
AfxMessageBox(strMsg);
}