fast-yolo4/fast/FastMainView.cpp

175 lines
3.2 KiB
C++
Raw Permalink Normal View History

2024-09-25 09:43:03 +08:00
// MFCApplication6View.cpp : FastMainView <20><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>
//
#include "stdafx.h"
// SHARED_HANDLERS <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɸѡ<C9B8><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// ATL <20><>Ŀ<EFBFBD>н<EFBFBD><D0BD>ж<EFBFBD><D0B6><EFBFBD><E5A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD>
#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 <20><><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD>
CFastMainView::CFastMainView()
: CFormView(IDD_MFCAPPLICATION6_FORM)
{
// TODO: <20>ڴ˴<DAB4><CBB4><EFBFBD><EFBFBD>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
}
CFastMainView::~CFastMainView()
{
}
void CFastMainView::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
}
BOOL CFastMainView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: <20>ڴ˴<DAB4>ͨ<EFBFBD><CDA8><EFBFBD>޸<EFBFBD>
// CREATESTRUCT cs <20><><EFBFBD>޸Ĵ<DEB8><C4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
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 <20><><EFBFBD><EFBFBD>
#ifdef _DEBUG
void CFastMainView::AssertValid() const
{
CFormView::AssertValid();
}
void CFastMainView::Dump(CDumpContext& dc) const
{
CFormView::Dump(dc);
}
/*
CFastMainDoc* CFastMainView::GetDocument() const // <20>ǵ<EFBFBD><C7B5>԰汾<D4B0><E6B1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CFastMainDoc)));
return (CFastMainDoc*)m_pDocument;
}*/
#endif //_DEBUG
// FastMainView <20><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void CFastMainView::OnSize(UINT nType, int cx, int cy)
{
CFormView::OnSize(nType, cx, cy);
if (nType == SIZE_MAXHIDE || nType == SIZE_MAXSHOW)
{
UpdataScreenPos();
}
}