// MainFrm.cpp : implementation of the CMainFrame class // #include "stdafx.h" #include "dimens.h" #include "MainFrm.h" #include "dimensDc.h" #include "dimensVw.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CMainFrame IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd) BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd) //{{AFX_MSG_MAP(CMainFrame) ON_WM_PALETTECHANGED() ON_WM_QUERYNEWPALETTE() ON_WM_PALETTEISCHANGING() ON_WM_SYSCOLORCHANGE() //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CMainFrame construction/destruction CMainFrame::CMainFrame() { LBase::SetErrorListDepth(20); LBase::LoadLibraries(LT_ALL_LEADLIB); LDialogBase::Initialize(DLG_INIT_COLOR); WRPUNLOCKSUPPORT(); } CMainFrame::~CMainFrame() { LDialogBase::Free(); LBase::UnloadLibraries(LT_ALL_LEADLIB); } BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { if( !CMDIFrameWnd::PreCreateWindow(cs) ) return FALSE; // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs cs.style = WS_OVERLAPPEDWINDOW | WS_CAPTION; cs.lpszName = _T("LEAD Class Library Win32 Dimension Demo"); return TRUE; } ///////////////////////////////////////////////////////////////////////////// // CMainFrame diagnostics #ifdef _DEBUG void CMainFrame::AssertValid() const { CMDIFrameWnd::AssertValid(); } void CMainFrame::Dump(CDumpContext& dc) const { CMDIFrameWnd::Dump(dc); } #endif //_DEBUG ///////////////////////////////////////////////////////////////////////////// // CMainFrame message handlers void CMainFrame::OnPaletteChanged(CWnd* pFocusWnd) { CMDIFrameWnd::OnPaletteChanged(pFocusWnd); if(pFocusWnd!=NULL) SendMessageToDescendants(WM_HANDLEPALETTE,(WPARAM)pFocusWnd->m_hWnd,TRUE); } BOOL CMainFrame::OnQueryNewPalette() { // TODO: Add your message handler code here and/or call default CMDIChildWnd* pMDIChildWnd = MDIGetActive(); if (pMDIChildWnd) { CDimView* pView =(CDimView*) pMDIChildWnd->GetActiveView(); if(pView) { pView->SendMessage(WM_HANDLEPALETTE,0,FALSE); return TRUE; } } return CMDIFrameWnd::OnQueryNewPalette(); } void CMainFrame::OnPaletteIsChanging(CWnd* pRealizeWnd) { OnPaletteChanged (pRealizeWnd); } void CMainFrame::OnSysColorChange() { OnQueryNewPalette(); }