📄 dvrmanager.cpp
字号:
// DvrManager.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "net.h"
#include "DvrManager.h"
#include "./toolbars/CreateUsers.h"
#include "./toolbars/UserChangeI.h"
#include "./toolbars/Loginin.h"
#include "DvrManagerDlg.h"
#include "msgbox.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDvrManagerApp
BEGIN_MESSAGE_MAP(CDvrManagerApp, CWinApp)
//{{AFX_MSG_MAP(CDvrManagerApp)
//}}AFX_MSG_MAP
ON_COMMAND(ID_HELP, OnHelp)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDvrManagerApp construction
CDvrManagerApp::OnHelp()
{
CString str;
str.Format(IDS_HELP_DOC);
ShellExecute(NULL, _T("Open"), str, NULL, NULL, SW_SHOW);
}
CDvrManagerApp::CDvrManagerApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CDvrManagerApp object
CDvrManagerApp theApp;
CString m_login_client_name("");
char m_system_directory[50];
Popedom_Setting m_login_client_popedom;
/////////////////////////////////////////////////////////////////////////////
// CDvrManagerApp initialization
void CDvrManagerApp::set_app_info()
{
free((void*)m_pszAppName);
m_pszAppName = _tcsdup(_T("DVR Client 3.6"));
SetRegistryKey(_T("DVR"));
}
bool check_dx81()
{
//-------------------------------------------------------------------------
// DirectX 8.1 Checks
//-------------------------------------------------------------------------
// Simply see if dpnhpast.dll exists.
HMODULE hDPNHPASTDLL = LoadLibrary( "dpnhpast.dll" );
if( hDPNHPASTDLL )
{
FreeLibrary( hDPNHPASTDLL );
return true;
}
return false;
}
bool check_desktop()
{
//return true;
int cx = GetSystemMetrics(SM_CXSCREEN);
int cy = GetSystemMetrics(SM_CYSCREEN);
if( cx != 1024 || cy != 768 )
return false;
return true;
}
bool check_font()
{
HDC dc = GetDC(GetDesktopWindow());
int res = GetDeviceCaps(dc, LOGPIXELSX);
ReleaseDC(GetDesktopWindow(), dc);
return res == 96;
}
#include "reg.h"
#include "single_instance.h"
#include "toolbars/rightlocal.h"
#include "utils/common.h"
BOOL CDvrManagerApp::InitInstance()
{
set_app_info();
GetSystemDirectory(m_system_directory,50);
if( _tcscmp(m_lpCmdLine, _T("/install")) == 0 )
{
CRightLocal rl;
rl.set_default();
TCHAR path[MAX_PATH];
GetModuleFileName(NULL, path, MAX_PATH);
write_string(_T("InstallPath"), _T("AppPath"), path);
return FALSE;
}
if( !check_dx81() )
{
/* CString str = _T("系统须要微软公司的DirectX 8.1以上版本支持\n");
str += _T("但是这台机器没有安装DirectX 8.1\n");
str += _T("请安装DirectX 8.1再重试.\n\n");
str += _T("系统现在将退出.");
CString title = _T("DirectX 8.1 未安装");
*/
IDString txt(IDS_DX81_TXT);
IDString title(IDS_DX81_TITLE);
MessageBox(NULL, txt, title, MB_OK | MB_ICONERROR);
return FALSE;
}
if( !check_desktop() )
{
/*
CString str = _T("Windows 桌面大小不正确.\n");
str += _T("请将Windows 桌面大小设置为1024x768, 再重试!\n\n");
str += _T("系统现在将退出.");
*/
IDString txt(IDS_DESKTOP_TXT);
IDString title(IDS_DESKTOP_TITLE);
MessageBox(NULL, txt, title, MB_OK | MB_ICONERROR);
return FALSE;
}
if( !check_font() )
{
IDString txt(IDS_FONTSIZE_TXT);
IDString title(IDS_FONTSIZE_TITLE);
MessageBox(NULL, txt, title, MB_OK | MB_ICONERROR);
return FALSE;
}
single_instance si(_T("DvrClient v3.6"));
if( !si.valid() )
{
AfxMessageBox(IDS_APP_ALREADY_RUN, MB_OK | MB_ICONERROR);
return FALSE;
}
AfxEnableControlContainer();
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
CLoginin logindlg;
int result=logindlg.DoModal();
if (result == IDOK)
{
CDvrManagerDlg dlg;
m_pMainWnd = &dlg;
dlg.DoModal();
return TRUE;
}
else if (result == IDCANCEL)
{
return FALSE;
}
return TRUE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -