123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- // ColorButton.cpp : implementation file
- //
- #include "stdafx.h"
- #include "newclient.h"
- #include "ColorButton.h"
- #include "MyOutput.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- extern CMyOutput myoutput[MAXVIEWNUM];
- extern WORD iActiveWndNumber;
- DWORD inumber = 0;
- /////////////////////////////////////////////////////////////////////////////
- // CColorButton
- CColorButton::CColorButton()
- {
- m_iSubButtonNum = inumber++;
- }
- CColorButton::~CColorButton()
- {
- }
- BEGIN_MESSAGE_MAP(CColorButton, CButton)
- //{{AFX_MSG_MAP(CColorButton)
- ON_WM_LBUTTONDOWN()
- ON_WM_LBUTTONUP()
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CColorButton message handlers
- void CColorButton::OnLButtonDown(UINT nFlags, CPoint point)
- {
- // TODO: Add your message handler code here and/or call default
- StockHandle = myoutput[iActiveWndNumber].m_iPlayhandle;
- if(StockHandle>=0)
- {
- switch(m_iSubButtonNum)
- {
- case 0: //云台上
- NET_DVR_PTZControl(StockHandle,TILT_UP,0);
- break;
- case 1: //云台下
- NET_DVR_PTZControl(StockHandle,TILT_DOWN,0);
- break;
- case 2: //云台左
- NET_DVR_PTZControl(StockHandle,PAN_LEFT,0);
- break;
- case 3: //云台右
- NET_DVR_PTZControl(StockHandle,PAN_RIGHT,0);
- break;
- case 4: //调焦左
- NET_DVR_PTZControl(StockHandle,ZOOM_IN,0);
- break;
- case 5: //调焦右
- NET_DVR_PTZControl(StockHandle,ZOOM_OUT,0);
- break;
- case 6: //聚焦左
- NET_DVR_PTZControl(StockHandle,FOCUS_NEAR,0);
- break;
- case 7: //聚焦右
- NET_DVR_PTZControl(StockHandle,FOCUS_FAR,0);
- break;
- case 8: //光圈左
- NET_DVR_PTZControl(StockHandle,IRIS_OPEN,0);
- break;
- case 9: //光圈右
- NET_DVR_PTZControl(StockHandle,IRIS_CLOSE,0);
- break;
- default:
- break;
- }
- }
- CButton::OnLButtonDown(nFlags, point);
- }
- void CColorButton::OnLButtonUp(UINT nFlags, CPoint point)
- {
- // TODO: Add your message handler code here and/or call default
- StockHandle = myoutput[iActiveWndNumber].m_iPlayhandle;
- if(StockHandle>=0)
- {
- switch(m_iSubButtonNum)
- {
- case 0: //云台上
- if(!NET_DVR_PTZControl(StockHandle,TILT_UP,1))
- {
- TRACE("云台控制失败 %d", NET_DVR_GetLastError());
- AfxMessageBox("云台控制失败");
- }
- break;
- case 1: //云台下
- if(!NET_DVR_PTZControl(StockHandle,TILT_DOWN,1))
- AfxMessageBox("云台控制失败");
- break;
- case 2: //云台左
- if(!NET_DVR_PTZControl(StockHandle,PAN_LEFT,1))
- AfxMessageBox("云台控制失败");
- break;
- case 3: //云台右
- if(!NET_DVR_PTZControl(StockHandle,PAN_RIGHT,1))
- AfxMessageBox("云台控制失败");
- break;
- case 4: //调焦左
- if(!NET_DVR_PTZControl(StockHandle,ZOOM_IN,1))
- AfxMessageBox("镜头控制失败");
- break;
- case 5: //调焦右
- if(!NET_DVR_PTZControl(StockHandle,ZOOM_OUT,1))
- AfxMessageBox("镜头控制失败");
- break;
- case 6: //聚焦左
- if(!NET_DVR_PTZControl(StockHandle,FOCUS_NEAR,1))
- AfxMessageBox("镜头控制失败");
- break;
- case 7: //聚焦右
- if(!NET_DVR_PTZControl(StockHandle,FOCUS_FAR,1))
- AfxMessageBox("镜头控制失败");
- break;
- case 8: //光圈左
- if(!NET_DVR_PTZControl(StockHandle,IRIS_OPEN,1))
- AfxMessageBox("镜头控制失败");
- break;
- case 9: //光圈右
- if(!NET_DVR_PTZControl(StockHandle,IRIS_CLOSE,1))
- AfxMessageBox("镜头控制失败");
- break;
- default:
- break;
- }
- }
- CButton::OnLButtonUp(nFlags, point);
- }
|