📄 bouncefrm.cpp
字号:
// BounceFrm.cpp : implementation file
//
#include "stdafx.h"
#include "MThread.h"
#include "BounceFrm.h"
#include "BounceThread.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CBounceFrame
IMPLEMENT_DYNCREATE(CBounceFrame, CMDIChildWnd)
CBounceFrame::CBounceFrame()
{
}
CBounceFrame::~CBounceFrame()
{
}
BEGIN_MESSAGE_MAP(CBounceFrame, CMDIChildWnd)
ON_WM_SIZE()
ON_MESSAGE(WM_USER_PREPARE_TO_CLOSE,OnPrepareToClose)
END_MESSAGE_MAP()
// CBounceFrame message handlers
CMenu CBounceFrame::menu;
BOOL CBounceFrame::Create(LPCTSTR szTitle, LONG style, const RECT& rect, CMDIFrameWnd* pParent)
{
// TODO: Add your specialized code here and/or call the base class
if(menu.m_hMenu==NULL)
menu.LoadMenu(IDR_BOUNCETYPE);
m_hMenuShared=menu.m_hMenu;
if(!CMDIChildWnd::Create(NULL,szTitle, style, rect, pParent))
return FALSE;
CBounceThread * pBounceThread=new CBounceThread(m_hWnd);
pBounceThread->CreateThread();
return TRUE;
}
BOOL CBounceFrame::DestroyWindow()
{
// TODO: Add your specialized code here and/or call the base class
OnPrepareToClose();
return CMDIChildWnd::DestroyWindow();
}
LRESULT CBounceFrame::OnPrepareToClose(WPARAM,LPARAM)
{
CWnd *pBounceView=(CBounceView *)GetDlgItem(IDC_BOUNCE_VIEW);
pBounceView->SendMessage(WM_USER_PREPARE_TO_CLOSE);
WaitForSingleObject(CBounceThread::m_hEventBounceThreadKilled,INFINITE);
return 0;
}
BOOL CBounceFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
{
CWnd *pBounceView=(CBounceView *)GetDlgItem(IDC_BOUNCE_VIEW);
if(pBounceView==NULL)
return FALSE;
COnCmdMsg oncmdmsg;
oncmdmsg.m_nID=nID;
oncmdmsg.m_nCode=nCode;
oncmdmsg.m_pExtra=pExtra;
oncmdmsg.m_pHandlerInfo=pHandlerInfo;
return pBounceView->SendMessage(WM_USER_ONCMDMSG,
GetCurrentMessage()->wParam,(LPARAM)&oncmdmsg);
}
void CBounceFrame::OnSize(UINT nType, int cx, int cy)
{
CMDIChildWnd::OnSize(nType, cx, cy);
// TODO: Add your message handler code here
CWnd *pBounceView=GetDlgItem(IDC_BOUNCE_VIEW);
if(pBounceView==NULL)
return;
CRect rect;
GetClientRect(&rect);
pBounceView->SetWindowPos(NULL,0,0,rect.Width(),rect.Height(),
SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOZORDER);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -