/***************************************************************************** * * Copyright (c) 1999, KL GROUP INC. All Rights Reserved. * http://www.klgroup.com * * This file is provided for demonstration and educational uses only. * Permission to use, copy, modify and distribute this file for * any purpose and without fee is hereby granted, provided that the * above copyright notice and this permission notice appear in all * copies, and that the name of KL Group not be used in advertising * or publicity pertaining to this material without the specific, * prior written permission of an authorized representative of * KL Group. * * KL GROUP MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY * OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR * PURPOSE, OR NON-INFRINGEMENT. KL GROUP SHALL NOT BE LIABLE FOR ANY * DAMAGES SUFFERED BY USERS AS A RESULT OF USING, MODIFYING OR * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. */ /* Project oc2owl OVERVIEW ======== Source file for implementation of oc2owlDecoratedMDIFrame (TDecoratedMDIFrame). */ #include #pragma hdrstop #include "oc2dmdif.h" // // Build a response table for all messages/commands handled // by the application. // DEFINE_RESPONSE_TABLE1(oc2owlDecoratedMDIFrame, TDecoratedMDIFrame) //{{oc2owlDecoratedMDIFrameRSP_TBL_BEGIN}} EV_WM_QUERYNEWPALETTE, EV_WM_PALETTECHANGED, //{{oc2owlDecoratedMDIFrameRSP_TBL_END}} END_RESPONSE_TABLE; //{{oc2owlDecoratedMDIFrame Implementation}} oc2owlDecoratedMDIFrame::oc2owlDecoratedMDIFrame (const char far* title, TResId menuResId, TMDIClient& clientWnd, bool trackMenuSelection, TModule* module): TDecoratedMDIFrame(title, menuResId, clientWnd, trackMenuSelection, module) { // INSERT>> Your constructor code here. } oc2owlDecoratedMDIFrame::~oc2owlDecoratedMDIFrame () { Destroy(); // INSERT>> Your destructor code here. } static void SendMessageToDescendants(HWND hWnd, UINT message, WPARAM wParam = 0, LPARAM lParam = 0, BOOL bDeep = TRUE, BOOL bOnlyPerm = TRUE) { for (HWND hWndChild = ::GetTopWindow(hWnd); hWndChild != NULL; hWndChild = ::GetWindow(hWndChild, GW_HWNDNEXT)) { // send message with Windows SendMessage API ::SendMessage(hWndChild, message, wParam, lParam); if (bDeep && ::GetTopWindow(hWndChild) != NULL) { // send to child windows after parent SendMessageToDescendants(hWndChild, message, wParam, lParam, bDeep, bOnlyPerm); } } } bool oc2owlDecoratedMDIFrame::EvQueryNewPalette () { HWND hWnd; bool result; hWnd = GetCommandTarget(); if((hWnd == NULL) || (hWnd == *this) || (hWnd == *GetClientWindow())) return FALSE; /* Make sure the window is at the top of the Z-order so that the background palettes can be realized before any other application gets a chance to realize a palette. */ /* In Windows for Workgroups, this message can be received before the window is moved to the top of the Z-order causing the first WM_PALETTECHANGED message to be sent not to this window but the window which was "previously" at the top of the Z-order. */ BringWindowToTop(); result = (bool)ForwardMessage(hWnd); SendMessageToDescendants(*this, WM_PALETTECHANGED); return result; } void oc2owlDecoratedMDIFrame::EvPaletteChanged (HWND) { SendMessageToDescendants(*this, WM_PALETTECHANGED); }