⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mdi.cpp

📁 VC++视频开发实例集锦(包括“远程视频监控”"语音识别系统"等13个经典例子)
💻 CPP
字号:
// mdi.cpp : Defines the class behaviors for the application.
//
// This is a part of the Microsoft Foundation Classes C++ library.
// Copyright (C) 1992-1998 Microsoft Corporation
// All rights reserved.
//
// This source code is only intended as a supplement to the
// Microsoft Foundation Classes Reference and related
// electronic documentation provided with the library.
// See these sources for detailed information regarding the
// Microsoft Foundation Classes product.

#include "stdafx.h"
#include "mdi.h"
#include "RevPlayThread.h"
#include "mainfrm.h"
#include  "winsock2.h"

#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CMdiApp

BEGIN_MESSAGE_MAP(CMdiApp, CWinApp)
	//{{AFX_MSG_MAP(CMdiApp)
	ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMdiApp construction
// Place all significant initialization in InitInstance

CMdiApp::CMdiApp()
{
}

/////////////////////////////////////////////////////////////////////////////
// The one and only CMdiApp object

CMdiApp NEAR theApp;

/////////////////////////////////////////////////////////////////////////////
// CMdiApp initialization

BOOL CMdiApp::InitInstance()
{
	// Win32 multi-threading APIs are not available on non-NT versions
	// of Windows less than Windows version 4.0.
	if ((::GetVersion() & 0x80000000) && (BYTE(::GetVersion()) < 4))
	{
		AfxMessageBox(IDS_CANNOT_RUN_ON_16BIT_WINDOWS_LT_4);
		return FALSE;
	}

	Enable3dControls();

	// create main MDI Frame window
	CMainFrame* pMainFrame = new CMainFrame;
	//if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
	if (!pMainFrame->LoadFrame(IDR_REVPLAY))
	
		return FALSE;
	m_nCmdShow=SW_MAXIMIZE;
	pMainFrame->ShowWindow(m_nCmdShow);
	pMainFrame->UpdateWindow();
	m_pMainWnd = pMainFrame;
	pMainFrame->m_bAutoMenuEnable=FALSE;
 	CRevPlayThread::m_hEventRevPlayThreadKilled
		= CreateEvent(NULL, FALSE, FALSE, NULL); // auto reset, initially reset
 	WSADATA WSAData;
	int status;
	if (!(status = WSAStartup(MAKEWORD(2,2), &WSAData)) == 0) 
	{
             AfxMessageBox("error StartUp");
			 return FALSE;
	}
	return TRUE;
}

int CMdiApp::ExitInstance()
{
//	CoUninitialize();
	WSACleanup();
	CloseHandle(CRevPlayThread::m_hEventRevPlayThreadKilled);
    return CWinApp::ExitInstance();
}

/////////////////////////////////////////////////////////////////////////////
// CMdiApp commands

void CMdiApp::OnAppAbout()
{
	CDialog(IDD_ABOUTBOX).DoModal();
}

/////////////////////////////////////////////////////////////////////////////
// other globals

// Color array maps to Color menu
COLORREF NEAR colorArray[] =
{
	RGB (0, 0, 0),
	RGB (255, 0, 0),
	RGB (0, 255, 0),
	RGB (0, 0, 255),
	RGB (255, 255, 255)
};

/////////////////////////////////////////////////////////////////////////////

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -