VideoDlg.cpp
资源名称:视频会议系统.rar [点击查看]
上传用户:popouu88
上传日期:2013-02-11
资源大小:2894k
文件大小:4k
源码类别:
IP电话/视频会议
开发平台:
Visual C++
- // VideoDlg.cpp : implementation file
- //
- #include "stdafx.h"
- #include "Control.h"
- #include "VideoDlg.h"
- #include "ComPelcod.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- extern CControlApp theApp;
- /////////////////////////////////////////////////////////////////////////////
- // CVideoDlg dialog
- CVideoDlg::CVideoDlg(CWnd* pParent /*=NULL*/)
- : CDialog(CVideoDlg::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CVideoDlg)
- //}}AFX_DATA_INIT
- this->user_id = 0;
- }
- void CVideoDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CVideoDlg)
- DDX_Control(pDX, IDC_SUB_IRIS, m_iris_sub);
- DDX_Control(pDX, IDC_ADD_IRIS, m_iris_add);
- DDX_Control(pDX, IDC_SUB_ZOOM, m_zoom_sub);
- DDX_Control(pDX, IDC_ADD_ZOOM, m_zoom_add);
- DDX_Control(pDX, IDC_SUB_FOCUS, m_focus_sub);
- DDX_Control(pDX, IDC_ADD_FOCUS, m_focus_add);
- DDX_Control(pDX, IDC_AUTO_BUTTON, m_auto);
- DDX_Control(pDX, IDC_RIGHT_BUTTON, m_right);
- DDX_Control(pDX, IDC_DOWN_BUTTON, m_down);
- DDX_Control(pDX, IDC_LEFT_BUTTON, m_left);
- DDX_Control(pDX, IDC_UP_BUTTON, m_up);
- DDX_Control(pDX, IDC_CONTROL_STATIC, m_ctrl_static);
- DDX_Control(pDX, IDC_VIDEO_STATIC, m_video);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CVideoDlg, CDialog)
- //{{AFX_MSG_MAP(CVideoDlg)
- ON_WM_CTLCOLOR()
- ON_WM_SIZE()
- ON_WM_NCHITTEST()
- ON_BN_CLICKED(IDC_AUTO_BUTTON, OnAutoButton)
- ON_BN_CLICKED(IDC_BUTTON, OnButton)
- //}}AFX_MSG_MAP
- ON_MESSAGE( WM_UPDOWNBUTTON ,OnUpDownButton )
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CVideoDlg message handlers
- BOOL CVideoDlg::OnInitDialog()
- {
- CDialog::OnInitDialog( );
- //上
- this->m_up.action = UP;
- //左
- this->m_left.action = LEFT;
- //下
- this->m_down.action = DOWN;
- //右
- this->m_right.action = RIGHT;
- //调焦
- this->m_focus_add.action = FOCUS_LARGEN;
- this->m_focus_sub.action = FOCUS_LESSEN;
- //变倍
- this->m_zoom_add.action = ZOOM_LARGEN;
- this->m_zoom_sub.action = ZOOM_LESSEN;
- //光圈
- this->m_iris_add.action = IRIS_LARGEN;
- this->m_iris_sub.action = IRIS_LESSEN;
- return TRUE;
- }
- UINT CVideoDlg::OnNcHitTest(CPoint point)
- {
- UINT hitTest = CDialog::OnNcHitTest(point);
- return hitTest == HTCLIENT ? HTCAPTION : hitTest;
- }
- void CVideoDlg::PostNcDestroy( )
- {
- delete this;
- }
- LRESULT CVideoDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
- {
- if( message == WM_CLOSE )
- {
- this->DestroyWindow( );
- return 0;
- }
- return CDialog::WindowProc( message , wParam , lParam );
- }
- HBRUSH CVideoDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
- {
- static HBRUSH b = ::CreateSolidBrush( RGB( 214 , 239 , 255 ) );
- pDC->SetBkMode( TRANSPARENT );
- if( nCtlColor == CTLCOLOR_STATIC )
- {
- if( pWnd->GetSafeHwnd( ) == this->m_video.GetSafeHwnd( ) )
- {
- static HBRUSH bb = ::CreateSolidBrush( RGB( 10 , 10 , 10 ) );
- pDC->SetTextColor( RGB( 255 , 0 , 0 ) );
- return bb;
- }
- }
- return b;
- }
- void CVideoDlg::OnSize(UINT nType, int cx, int cy)
- {
- CDialog::OnSize( nType , cx , cy );
- static int width = 0;
- if( this->m_ctrl_static )
- {
- if( ! width )
- {
- CRect rc;
- this->m_ctrl_static.GetWindowRect( &rc );
- width = rc.Width( ) + 5;
- }
- // this->m_ctrl_static.MoveWindow( 0 , 0 , width , cy );
- }
- if( this->m_video )
- this->m_video.MoveWindow( width , 0 , cx - width , cy );
- this->Invalidate( );
- }
- void CVideoDlg::OnUpDownButton( WPARAM wParam , LPARAM lParam )
- {
- if( wParam )
- {
- if( this->m_auto.GetCheck( ) )
- {
- this->m_auto.SetCheck( 0 );
- }
- PPanelCommand cmd;
- cmd.assembleData( this->user_id , ( int )wParam , ( bool )lParam );
- theApp.GetTCP( ).Send( cmd.buffer );
- }
- }
- void CVideoDlg::OnAutoButton( )
- {
- PPanelCommand cmd;
- cmd.assembleData( this->user_id , AUTO , this->m_auto.GetCheck( ) );
- theApp.GetTCP( ).Send( cmd.buffer );
- }
- void CVideoDlg::OnButton()
- {
- PPanelCommand cmd;
- cmd.assembleData( this->user_id , FULLSCREEN , 2 );
- theApp.GetTCP( ).Send( cmd.buffer );
- }