⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 voice_callrecord.cpp

📁 EVC中读取XML文件
💻 CPP
字号:
// Voic_CallRecord.cpp : implementation file
//

#include "stdafx.h"
#include "minimonitor.h"
#include "Voice_CallRecord.h"
#include "Markup.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// Voic_CallRecord dialog


Voice_CallRecord::Voice_CallRecord(CWnd* pParent /*=NULL*/)
	: CDialog(Voice_CallRecord::IDD, pParent)
{
	//{{AFX_DATA_INIT(Voic_CallRecord)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void Voice_CallRecord::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(Voic_CallRecord)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	DDX_Control(pDX, IDC_LISTCtrl, m_List);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(Voice_CallRecord, CDialog)
	//{{AFX_MSG_MAP(Voice_CallRecord)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// Voic_CallRecord message handlers

BOOL Voice_CallRecord::OnInitDialog() 
{
	m_bFullScreen = true;
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	// insert columns into listctrl
	CRect rc;
	m_List.GetClientRect(&rc);
	m_List.SetExtendedStyle(m_List.GetExtendedStyle() | LVS_EX_FULLROWSELECT );//|LVS_EX_GRIDLINES
	m_List.InsertColumn(0,_T("PhoneNum"),LVCFMT_LEFT,80);
	m_List.InsertColumn(1,_T("call time"),LVCFMT_LEFT,100);
	m_List.InsertColumn(2,_T("status"),LVCFMT_LEFT,rc.Width()-160);

	//get xml file path
	TCHAR pBuf[50];
	GetModuleFileName(NULL,pBuf,sizeof(pBuf)/sizeof(wchar_t));
	CString  str;    
	str.Format(_T("%s"),pBuf); 
	
	CString m_XMLPath = AfxGetAppName();
	m_XMLPath = str.Left(str.GetLength()-m_XMLPath.GetLength()-4);
	m_XMLPath = m_XMLPath + "PhoneInof.xml";//PhoneInof.xml  callrecord.xml

	// get xml node, and insert nodes into listctrl columns
	CMarkup xml;
	int i=0;
	if(xml.Load(m_XMLPath))
	{
		CString strTagName = _T("");
		CString strData = _T("");
		int iRowNum = -1;
		while(xml.FindChildElem())
		{
			xml.IntoElem();
			iRowNum++;
			m_List.InsertItem(iRowNum,_T("Test"));  

			strTagName = xml.GetAttribName(0);
			strData = xml.GetAttrib(strTagName);
			m_List.SetItemText(iRowNum,0,strData);

			strTagName = xml.GetAttribName(1);
			strData = xml.GetAttrib(strTagName);
			m_List.SetItemText(iRowNum,1,strData);

			strTagName = xml.GetAttribName(2);
			strData = xml.GetAttrib(strTagName);
			if (strData == "1")
				strData = "呼入";
			else if (strData == "2")
				strData = "呼出";
			else if (strData == "3")
				strData = "拒接";
			else 
				strData = "挂断";
			m_List.SetItemText(iRowNum,2,strData);

			xml.OutOfElem();
		}
	}
	else
	{
		AfxMessageBox(_T("error"),NULL,MB_OK);
	}
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -