// Info.cpp : implementation file // #include "stdafx.h" #include "netapp.h" #include "NetInfo.h" ///////////////////////////////////////////////////////////////////////////// // CNetInfoDlg dialog CNetInfoDlg::CNetInfoDlg(CWnd* pParent /*=NULL*/) : CDialog(CNetInfoDlg::IDD, pParent) { //{{AFX_DATA_INIT(CNetInfoDlg) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); } void CNetInfoDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CNetInfoDlg) DDX_Control(pDX, IDC_PRESENTATION, m_Presentation); DDX_Control(pDX, IDC_B_MAX_LENGTH, m_bMaxLength); DDX_Control(pDX, IDC_B_IMPLEMENT_VERSION, m_bImplementVersion); DDX_Control(pDX, IDC_B_IMPLEMENT_CLASS, m_bImplementClass); DDX_Control(pDX, IDC_B_ASYNC_OPERATIONS, m_bAsyncOperations); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CNetInfoDlg, CDialog) //{{AFX_MSG_MAP(CNetInfoDlg) // NOTE: the ClassWizard will add message map macros here //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CNetInfoDlg message handlers BOOL CNetInfoDlg::OnInitDialog() { CDialog::OnInitDialog(); // Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon L_INT i, nIndex; L_UINT32 j; L_UCHAR nID; pDICOMUID pUID; L_UCHAR *p; CString strText; CString strHexa; SetDlgItemText(IDC_CALLED, m_pAssociate->GetCalled()); SetDlgItemText(IDC_CALLING, m_pAssociate->GetCalling()); SetDlgItemInt(IDC_VERSION, m_pAssociate->GetVersion(), FALSE); SetDlgItemText(IDC_APPLICATION, m_pAssociate->GetApplication()); if (m_pAssociate->IsMaxLength()) { m_bMaxLength.SetCheck(1); SetDlgItemInt(IDC_MAX_LENGTH, m_pAssociate->GetMaxLength(), FALSE); } if (m_pAssociate->IsImplementClass()) { m_bImplementClass.SetCheck(1); SetDlgItemText(IDC_IMPLEMENT_CLASS, m_pAssociate->GetImplementClass()); } if (m_pAssociate->IsAsyncOperations()) { m_bAsyncOperations.SetCheck(1); SetDlgItemInt(IDC_INVOKED, m_pAssociate->GetInvokedOperations(), FALSE); SetDlgItemInt(IDC_PERFORMED, m_pAssociate->GetPerformedOperations(), FALSE); } if (m_pAssociate->IsImplementVersion()) { m_bImplementVersion.SetCheck(1); SetDlgItemText(IDC_IMPLEMENT_VERSION, m_pAssociate->GetImplementVersion()); } m_bMaxLength.EnableWindow(FALSE); m_bImplementClass.EnableWindow(FALSE); m_bAsyncOperations.EnableWindow(FALSE); m_bImplementVersion.EnableWindow(FALSE); m_Presentation.InsertColumn(0, "ID", LVCFMT_LEFT, 30, 1); m_Presentation.InsertColumn(1, "Abstract", LVCFMT_LEFT, 310, 2); m_Presentation.InsertColumn(2, "Result", LVCFMT_LEFT, 170, 3); m_Presentation.InsertColumn(3, "Transfer", LVCFMT_LEFT, 150, 4); m_Presentation.InsertColumn(4, "User", LVCFMT_LEFT, 40, 5); m_Presentation.InsertColumn(5, "Provider", LVCFMT_LEFT, 60, 6); m_Presentation.InsertColumn(6, "Extended", LVCFMT_LEFT, 70, 7); for (i = 0; i < m_pAssociate->GetPresentationCount(); i++) { nID = m_pAssociate->GetPresentation(i); nIndex = m_Presentation.InsertItem(m_Presentation.GetItemCount(), "Z"); strText.Format("%u", nID); m_Presentation.SetItem(nIndex, 0, LVIF_TEXT|LVIF_STATE, strText, 0, LVIS_SELECTED, LVIS_SELECTED, 0); if (m_pAssociate->GetAbstract(nID) != NULL) { pUID = LDicomUID::Find(m_pAssociate->GetAbstract(nID)); if (pUID != NULL) { strText = pUID->pszName; } else { strText = m_pAssociate->GetAbstract(nID); } m_Presentation.SetItem(nIndex, 1, LVIF_TEXT|LVIF_STATE, strText, 0, LVIS_SELECTED, LVIS_SELECTED, 0); } switch (m_pAssociate->GetResult(nID)) { case PDU_ACCEPT_RESULT_SUCCESS: m_Presentation.SetItem(nIndex, 2, LVIF_TEXT|LVIF_STATE, "Accepted", 0, LVIS_SELECTED, LVIS_SELECTED, 0); break; case PDU_ACCEPT_RESULT_USER_REJECT: m_Presentation.SetItem(nIndex, 2, LVIF_TEXT|LVIF_STATE, "User rejection", 0, LVIS_SELECTED, LVIS_SELECTED, 0); break; case PDU_ACCEPT_RESULT_PROVIDER_REJECT: m_Presentation.SetItem(nIndex, 2, LVIF_TEXT|LVIF_STATE, "No reason rejection", 0, LVIS_SELECTED, LVIS_SELECTED, 0); break; case PDU_ACCEPT_RESULT_ABSTRACT_SYNTAX: m_Presentation.SetItem(nIndex, 2, LVIF_TEXT|LVIF_STATE, "Abstract syntax not supported", 0, LVIS_SELECTED, LVIS_SELECTED, 0); break; case PDU_ACCEPT_RESULT_TRANSFER_SYNTAX: m_Presentation.SetItem(nIndex, 2, LVIF_TEXT|LVIF_STATE, "Abstract syntax not supported", 0, LVIS_SELECTED, LVIS_SELECTED, 0); break; } if (m_pAssociate->GetResult(nID) == PDU_ACCEPT_RESULT_SUCCESS) { if (m_pAssociate->GetTransfer(nID, 0) != NULL) { pUID = LDicomUID::Find(m_pAssociate->GetTransfer(nID, 0)); if (pUID != NULL) { strText = pUID->pszName; } else { strText = m_pAssociate->GetTransfer(nID, 0); } m_Presentation.SetItem(nIndex, 3, LVIF_TEXT|LVIF_STATE, strText, 0, LVIS_SELECTED, LVIS_SELECTED, 0); } if (m_pAssociate->IsRoleSelect(nID) != FALSE) { switch (m_pAssociate->GetUserRole(nID)) { case PDU_ROLE_NON_SUPPORT: strText = "Non Support"; break; case PDU_ROLE_SUPPORT: strText = "Support"; break; default: strText = "Unknwon"; break; } m_Presentation.SetItem(nIndex, 4, LVIF_TEXT|LVIF_STATE, strText, 0, LVIS_SELECTED, LVIS_SELECTED, 0); switch (m_pAssociate->GetProviderRole(nID)) { case PDU_ROLE_NON_SUPPORT: strText = "Non Support"; break; case PDU_ROLE_SUPPORT: strText = "Support"; break; default: strText = "Unknwon"; break; } m_Presentation.SetItem(nIndex, 5, LVIF_TEXT|LVIF_STATE, strText, 0, LVIS_SELECTED, LVIS_SELECTED, 0); } if (m_pAssociate->GetLengthExtended(nID) != 0) { p = m_pAssociate->GetExtended(nID); if (p != NULL) { strText = ""; for (j = 0; j < m_pAssociate->GetLengthExtended(nID); j++) { strHexa.Format("%u ", p[j]); strText += strHexa; } m_Presentation.SetItem(nIndex, 6, LVIF_TEXT|LVIF_STATE, strText, 0, LVIS_SELECTED, LVIS_SELECTED, 0); } } } } return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }