175 lines
3.2 KiB
C++
175 lines
3.2 KiB
C++
|
|
// MFCApplication6View.cpp : FastMainView 类的实现
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
// SHARED_HANDLERS 可以在实现预览、缩略图和搜索筛选器句柄的
|
|
// ATL 项目中进行定义,并允许与该项目共享文档代码。
|
|
#ifndef SHARED_HANDLERS
|
|
#include "Fast.h"
|
|
#endif
|
|
|
|
#include "FastMainDoc.h"
|
|
#include "FastMainView.h"
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#endif
|
|
|
|
|
|
// FastMainView
|
|
|
|
IMPLEMENT_DYNCREATE(CFastMainView, CFormView)
|
|
|
|
BEGIN_MESSAGE_MAP(CFastMainView, CFormView)
|
|
ON_WM_SIZE()
|
|
END_MESSAGE_MAP()
|
|
|
|
// FastMainView 构造/析构
|
|
|
|
CFastMainView::CFastMainView()
|
|
: CFormView(IDD_MFCAPPLICATION6_FORM)
|
|
{
|
|
// TODO: 在此处添加构造代码
|
|
|
|
}
|
|
|
|
CFastMainView::~CFastMainView()
|
|
{
|
|
}
|
|
|
|
void CFastMainView::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CFormView::DoDataExchange(pDX);
|
|
}
|
|
|
|
BOOL CFastMainView::PreCreateWindow(CREATESTRUCT& cs)
|
|
{
|
|
// TODO: 在此处通过修改
|
|
// CREATESTRUCT cs 来修改窗口类或样式
|
|
|
|
return CFormView::PreCreateWindow(cs);
|
|
}
|
|
|
|
void CFastMainView::OnInitialUpdate()
|
|
{
|
|
CFormView::OnInitialUpdate();
|
|
GetParentFrame()->RecalcLayout();
|
|
//ResizeParentToFit();
|
|
|
|
InitNetSDK();
|
|
|
|
m_ptzScreen.Create(NULL, NULL, WS_CHILD | WS_VISIBLE, CRect(0, 0, 0, 0), this, 1981);
|
|
UpdataScreenPos();
|
|
m_ptzScreen.ShowWindow(SW_SHOW);
|
|
/*m_ptzScreen.SetCallBack(MessageProcFunc, (LDWORD)this,
|
|
GetParamsFunc, (LDWORD)this,
|
|
SetParamsFunc, (LDWORD)this,
|
|
RectEventFunc, (LDWORD)this);*/
|
|
m_ptzScreen.SetShowPlayWin(SPLIT16, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Callback function when device disconnected
|
|
void CALLBACK DisConnectFunc(LLONG lLoginID, char *pchDVRIP, LONG nDVRPort, LDWORD dwUser)
|
|
{
|
|
if (dwUser == 0)
|
|
{
|
|
return;
|
|
}
|
|
/*
|
|
CRealPlayAndPTZControlDlg *pThis = (CRealPlayAndPTZControlDlg *)dwUser;
|
|
HWND hWnd = pThis->GetSafeHwnd();
|
|
if (NULL == hWnd)
|
|
{
|
|
return;
|
|
}
|
|
PostMessage(hWnd, WM_DEVICE_DISCONNECT, NULL, NULL);*/
|
|
}
|
|
|
|
|
|
void CALLBACK ReConnectFunc(LLONG lLoginID, char *pchDVRIP, LONG nDVRPort, LDWORD dwUser)
|
|
{
|
|
if (dwUser == 0)
|
|
{
|
|
return;
|
|
}
|
|
/*
|
|
CRealPlayAndPTZControlDlg *pThis = (CRealPlayAndPTZControlDlg *)dwUser;
|
|
HWND hWnd = pThis->GetSafeHwnd();
|
|
if (NULL == hWnd)
|
|
{
|
|
return;
|
|
}
|
|
PostMessage(hWnd, WM_DEVICE_RECONNECT, NULL, NULL);*/
|
|
}
|
|
|
|
//Initialize net SDK
|
|
void CFastMainView::InitNetSDK()
|
|
{
|
|
//Initialize net sdk, All callback begins here.
|
|
BOOL bSuccess = CLIENT_Init(DisConnectFunc, (LDWORD)this);
|
|
if (!bSuccess)
|
|
{
|
|
//Display function error occurrs reason.
|
|
//LastError();
|
|
}
|
|
else
|
|
{
|
|
LOG_SET_PRINT_INFO stLogPrintInfo = { sizeof(stLogPrintInfo) };
|
|
CLIENT_LogOpen(&stLogPrintInfo);
|
|
CLIENT_SetAutoReconnect(ReConnectFunc, (LDWORD)this);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
void CFastMainView::UpdataScreenPos()
|
|
{
|
|
GetClientRect(&m_clientRect);
|
|
|
|
//m_screenRect = m_clientRect;
|
|
m_ptzScreen.MoveWindow(m_clientRect);
|
|
}
|
|
|
|
|
|
// FastMainView 诊断
|
|
|
|
#ifdef _DEBUG
|
|
void CFastMainView::AssertValid() const
|
|
{
|
|
CFormView::AssertValid();
|
|
}
|
|
|
|
void CFastMainView::Dump(CDumpContext& dc) const
|
|
{
|
|
CFormView::Dump(dc);
|
|
}
|
|
/*
|
|
CFastMainDoc* CFastMainView::GetDocument() const // 非调试版本是内联的
|
|
{
|
|
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CFastMainDoc)));
|
|
return (CFastMainDoc*)m_pDocument;
|
|
}*/
|
|
#endif //_DEBUG
|
|
|
|
|
|
// FastMainView 消息处理程序
|
|
|
|
|
|
void CFastMainView::OnSize(UINT nType, int cx, int cy)
|
|
{
|
|
CFormView::OnSize(nType, cx, cy);
|
|
|
|
if (nType == SIZE_MAXHIDE || nType == SIZE_MAXSHOW)
|
|
{
|
|
UpdataScreenPos();
|
|
}
|
|
}
|