// PageServer.cpp : implementation file // #include "stdafx.h" #include "mgrnve.h" #include "PageServer.h" #include "ConnectionManager.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CPageServer dialog CPageServer::CPageServer(CWnd* pParent, CMgrNVE* pMgrCM, CConnectionManager *pConnMgr) : CParamDlg(CPageServer::IDD, pParent, pMgrCM, pConnMgr) { //{{AFX_DATA_INIT(CPageServer) //}}AFX_DATA_INIT } void CPageServer::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CPageServer) //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CPageServer, CDialog) //{{AFX_MSG_MAP(CPageServer) ON_BN_CLICKED(IDC_BTN_DELETE, OnBtnDelete) ON_WM_DESTROY() //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CPageServer message handlers BOOL CPageServer::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here m_pNet5Api = m_pConnection->GetNet5Api(); m_ThreadLossInfo.StartThread(ThreadLossInfoStub, this, NULL, NULL); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void CPageServer::OnDestroy() { CDialog::OnDestroy(); // TODO: Add your message handler code here m_ThreadLossInfo.StopThread(1); } BOOL CPageServer::SaveSetting() { return TRUE; } BOOL CPageServer::ResetSetting() { return TRUE; } BOOL CPageServer::UpdateSetting() { return TRUE; } void CPageServer::OnBtnDelete() { // TODO: Add your control notification handler code here m_pMgrNVE->DeleteServer(m_pConnection); } DWORD WINAPI CPageServer::ThreadLossInfoStub(LPVOID lpParameter) { THREAD_PARAM_SET *pParam = (THREAD_PARAM_SET*)lpParameter; return static_cast(pParam->pParam2)->ThreadLossInfo(lpParameter); } DWORD WINAPI CPageServer::ThreadLossInfo(LPVOID lpParameter) { BOOL bRun = TRUE; NET5_STATISTICS_INFO Info; THREAD_PARAM_SET *pParam = (THREAD_PARAM_SET*)lpParameter; CUserThread *pThread = (CUserThread*)pParam->pParam1; while (bRun) { ULONG uRet = WaitForSingleObject(pThread->GetKillHandle(), 1000); if (uRet == WAIT_OBJECT_0) { break; } m_pNet5Api->Net5Command(NET5_NC_GET_STATISTICS, (ULONG*)&Info, NULL, NULL, NULL); SetDlgItemInt(IDC_STATIC_LOST_VIDEO, Info.uLostVideoFrame); SetDlgItemInt(IDC_STATIC_LOST_AUDIO, Info.uLostAudioPacket); SetDlgItemInt(IDC_STATIC_LOST_EVENT, Info.uLostEventPacket); } return 0; }