MDI.CPP
资源名称:VC++视频传输.rar [点击查看]
上传用户:hxb_1234
上传日期:2010-03-30
资源大小:8328k
文件大小:3k
源码类别:
VC书籍
开发平台:
Visual C++
- // 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)
- };
- /////////////////////////////////////////////////////////////////////////////