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

📄 dlgviewconnect.cpp

📁 MPEG4网络视频服务器客户端图象监控软件
💻 CPP
字号:
// DlgViewConnect.cpp : implementation file
//

#include "stdafx.h"
#include "DvsUser.h"
#include "DlgViewConnect.h"

#include "DvsUserDlg.h"

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

extern CDvsUserDlg*	g_User;
/////////////////////////////////////////////////////////////////////////////
// CDlgViewConnect dialog
//---------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------
CDlgViewConnect::CDlgViewConnect(CWnd* pParent /*=NULL*/)
	: CDialog(CDlgViewConnect::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDlgViewConnect)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
	hMonitor = AfxGetApp()->LoadIcon(IDI_ICON_MON);
}
//---------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------
void CDlgViewConnect::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDlgViewConnect)
	DDX_Control(pDX, IDC_CONNECT_LIST, m_connect_list);
	//}}AFX_DATA_MAP
}
//---------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------
BEGIN_MESSAGE_MAP(CDlgViewConnect, CDialog)
	//{{AFX_MSG_MAP(CDlgViewConnect)
	ON_BN_CLICKED(IDC_CONNECT_DISCONNECT, OnConnectDisconnect)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDlgViewConnect message handlers
//---------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------
BOOL CDlgViewConnect::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	InitControl();
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
//---------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------
void CDlgViewConnect::InitControl()
{
	imageMonitor.Create(16, 16, ILC_COLOR8, 1, 1);
	imageMonitor.Add(hMonitor);
	
	m_connect_list.SetImageList(&imageMonitor, LVSIL_SMALL);
	m_connect_list.SetExtendedStyle(LVS_EX_FULLROWSELECT|LVS_EX_ONECLICKACTIVATE|LVS_EX_SUBITEMIMAGES);
	m_connect_list.InsertColumn(0, _TEXT("监视窗口"), LVCFMT_LEFT, 90);
	m_connect_list.InsertColumn(1, _TEXT("编码器名称"), 0, 90);
	m_connect_list.InsertColumn(2, _TEXT("摄象机名称"));
	m_connect_list.SetColumnWidth(2, LVSCW_AUTOSIZE_USEHEADER);

	CString strTmp;
	int nListNum = 0;
	for(int i=0; i<4; i++)
	{
		if(g_User->LINK[i].bLinkState)
		{
			strTmp.Format(_TEXT("第%d监控窗口"), i+1);
			m_connect_list.InsertItem(nListNum, strTmp, 0);
			m_connect_list.SetItemText(nListNum, 1, g_User->CARD[g_User->LINK[i].dwCard].szCardName);
			m_connect_list.SetItemText(nListNum, 2, g_User->CARD[g_User->LINK[i].dwCard].Brance[g_User->LINK[i].dwBrance].szBranceName);
			nListNum ++;
		}
	}	
}
//---------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------
void CDlgViewConnect::OnConnectDisconnect() 
{
	int nSel;
	CString strTemp;

	nSel = m_connect_list.GetNextItem(-1, LVNI_SELECTED);
	if(nSel != -1)
	{
		strTemp = m_connect_list.GetItemText(nSel, 0);
		DisConnect(strTemp);
		m_connect_list.DeleteItem(nSel);
	}	
}
//---------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------
void CDlgViewConnect::DisConnect(CString strMonitorName)
{
	if(strMonitorName == _TEXT("第1监控窗口"))
	{
		g_User->LINK[0].bLinkState	= 0;
//		g_User->SetAVInfo(g_User->LINK[0].dwCard, 0xff);
		g_User->OnSendVideoStop(g_User->LINK[0].dwCard, g_User->LINK[0].dwBrance);
		g_User->m_view1_bar.SetTitle(_T("万力电子远程监控系统"));
	}

	else if(strMonitorName == _TEXT("第2监控窗口"))
	{
		g_User->LINK[1].bLinkState	= 0;
//		g_User->SetAVInfo(g_User->LINK[1].dwCard, 0xff);
		g_User->OnSendVideoStop(g_User->LINK[1].dwCard, g_User->LINK[1].dwBrance);
		g_User->m_view2_bar.SetTitle(_T("万力电子远程监控系统"));
	}

	else if(strMonitorName == _TEXT("第3监控窗口"))
	{
		g_User->LINK[2].bLinkState	= 0;
//		g_User->SetAVInfo(g_User->LINK[2].dwCard, 0xff);
		g_User->OnSendVideoStop(g_User->LINK[2].dwCard, g_User->LINK[2].dwBrance);
		g_User->m_view3_bar.SetTitle(_T("万力电子远程监控系统"));
	}

	else{
		g_User->LINK[3].bLinkState	= 0;
//		g_User->SetAVInfo(g_User->LINK[3].dwCard, 0xff);
		g_User->OnSendVideoStop(g_User->LINK[3].dwCard, g_User->LINK[3].dwBrance);
		g_User->m_view4_bar.SetTitle(_T("万力电子远程监控系统"));
	}	
}
//---------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------

⌨️ 快捷键说明

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