MAINFRM.CPP
资源名称:VC++视频传输.rar [点击查看]
上传用户:hxb_1234
上传日期:2010-03-30
资源大小:8328k
文件大小:3k
源码类别:
VC书籍
开发平台:
Visual C++
- // mainfrm.cpp : implementation of the CMainFrame class
- //
- // 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 "RevPlayMDIChildWnd.h"
- #include "mdi.h"
- #include "mainfrm.h"
- #ifdef _DEBUG
- #undef THIS_FILE
- static char BASED_CODE THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CMainFrame
- IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd)
- BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
- //{{AFX_MSG_MAP(CMainFrame)
- ON_COMMAND(IDM_REQUEST, OnRequest)
- ON_WM_CREATE()
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CMainFrame construction/destruction
- static UINT indicators[] =
- {
- ID_SEPARATOR, // status line indicator
- ID_SEPARATOR,
- ID_SEPARATOR,
- ID_SEPARATOR,
- };
- CMainFrame::CMainFrame()
- {
- }
- CMainFrame::~CMainFrame()
- {
- }
- /////////////////////////////////////////////////////////////////////////////
- // CMainFrame commands
- static BOOL CALLBACK SendPrepareToClose(HWND hWnd, LPARAM)
- {
- CWnd* pWnd = CWnd::FromHandlePermanent(hWnd);
- if (pWnd != NULL)
- {
- pWnd->SendMessage(WM_USER_PREPARE_TO_CLOSE);
- if (pWnd->GetWindow(GW_CHILD) != NULL)
- ::EnumChildWindows(pWnd->m_hWnd, SendPrepareToClose, 0);
- }
- return TRUE;
- }
- BOOL CMainFrame::DestroyWindow()
- {
- ::EnumChildWindows(m_hWnd, SendPrepareToClose, 0);
- return CMDIFrameWnd::DestroyWindow();
- }
- void CMainFrame::OnRequest()
- {
- // TODO: Add your command handler code here
- RECT rect;
- CRevPlayMDIChildWnd *pRevPlayMDIChildWnd = new CRevPlayMDIChildWnd;
- GetClientRect(&rect);
- //调用子框架窗口的创建函数
- if (!pRevPlayMDIChildWnd->Create( _T("接收播放"),rect,this))
- return;
- }
- int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
- {
- if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
- return -1;
- // TODO: Add your specialized creation code here
- if (!m_wndStatusBar.Create(this,WS_CHILD|WS_VISIBLE|CBRS_BOTTOM,ID_STATUS_BAR)
- ||!m_wndStatusBar.SetIndicators(indicators,
- sizeof(indicators)/sizeof(UINT)))
- {
- TRACE0("Failed to create status barn");
- return -1; // fail to create
- }
- return 0;
- }