SAMPLE: MULTICON Demonstrates Dynamic Icons

Last reviewed: July 10, 1997
Article ID: Q113251
1.00 1.50 1.51 1.52 | 1.00 2.00 2.10 4.00
WINDOWS             | WINDOWS NT
kbprg kbfile

The information in this article applies to:

  • The Microsoft Foundation Classes (MFC) included with: - The Microsoft Visual C++ for Windows, versions 1.5, 1.51, and

         1.52
    
    - The Microsoft Visual C++ 32-bit Edition, versions 1.0, 2.0, 2.1, 4.0,

         4.1
    

SUMMARY

The MULTICON sample demonstrates how to implement dynamic icons for both CMDIChildWnd and CMDIFrameWnd windows. The procedure is to first register a window class with a NULL icon for the frame. A frame of this type receives WM_PAINT messages when it becomes iconic, and can output to a 36 x 36* pixel area. To prevent duplicating output code from the view, the frame can call its view's OnDraw member to do the output.

Note: Dynamically animated application icons will not work on Windows 95 and versions of Windows NT after 3.51.

MULTICON can be downloaded as a self-extracting file from the Microsoft Software Library (MSL) on the following services:

  • Microsoft Download Service (MSDL)

          Dial (206) 936-6735 to connect to MSDL
          Download MULTICON.EXE (size: 47498 bytes) 
    
  • Internet (anonymous FTP)

          ftp ftp.microsoft.com
          Change to the \softlib\mslfiles directory
          Get MULTICON.EXE (size: 47498 bytes) 
    

This file contains subdirectories, be sure to use the -d command line switch while extracting.

MORE INFORMATION

Two simple view classes are used to demonstrate dynamic icons: CRectView and CEllipseView. These classes draw a random rectangle and a random ellipse, respectively. CWinApp::OnIdle is overridden to invalidate each open view and each minimized frame window. The MULTICON sample also demonstrates how to scale the output from an open view to fit a minimized frame, and how to convert the minimized frame's output to an icon during a drag operation.

*For Windows 3.1, subject to change in future versions of Windows.

Feature (How to...)                            Location(s)
-------------------                            -----------

Generate random rectangles ................... RECTVIEW.CPP
                                               CRectView::OnDraw

Generate random ellipses ..................... ELLPSEVW.CPP:
                                               CEllipseView::OnDraw

Register a window class with a NULL icon ......................................... MAINFRM.CPP:
                                               CMainFrame::PreCreateWindow

Render on a minimized CMDIFrameWnd using the application's active view .................... CMainFrame::OnPaint

Convert the display of a minimized CMDIFrameWnd to an icon ...................... CMainFrame::QueryDragIcon

Enable OnIdle processing while a menu or modal dialog is displayed .................... CMainFrame::OnEnterIdle

Render on a minimized CMDIChildWnd using the   ICONWND.CPP:
associated view .............................. CIconWnd::OnPaint

Convert the display of a minimized CMDIChildWnd to an icon ...................... CIconWnd::QueryDragIcon

Drive animated views and icons in the          MULTICON.CPP:
background ................................... CMulticonApp::OnIdle


Additional reference words: kbinf 1.00 1.5 1.51 1.52 2.0 2.10 2.5 2.51 2.52
3.00 3.10 4.00 4.10 dynamic mdi frame child
KBCategory: kbprg kbfile
KBSubcategory: MfcUI
Keywords : MfcUI kbfile kbprg
Technology : kbMfc
Version : 1.00 1.50 1.51 1.52 | 1.00 2.00
Platform : NT WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: July 10, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.