Creating Applications that Task Manager Does Not Tile

Last reviewed: July 23, 1997
Article ID: Q81708
3.00 3.10 WINDOWS kbprg

The information in this article applies to:

  • Microsoft Windows Software Development Kit (SDK) for Windows, versions 3.0 and 3.1

SUMMARY

A variety of applications that provide various types of information have been developed for the Windows graphical environment. Depending on the amount of information that the application presents, an application icon may provide enough screen space to show the information. The FREEMEM program in Chapter 5 of Charles Petzold's book "Programming Windows 3" (Microsoft Press) demonstrates presenting status data on an icon.

When an application has more data than can be readily represented on an icon, the user will often size the application to provide just the information necessary, and place the application's window in a convenient place on the screen. However, in this situation, if the user selects Cascade or Tile from the Task Manager window to arrange the active applications, the status window will probably change size and position on the screen.

This article presents a technique that an application can use to prevent itself from being cascaded or tiled by the Task Manager.

MORE INFORMATION

To prevent an application from changing position when the Task Manager rearranges windows, perform the following four steps:

  1. Create a minimum window procedure, called DummyWndProc, with the following code:

    long FAR PASCAL DummyWndProc(HWND hwnd, WORD message,

                                    WORD wParam, LONG lParam)
       {
          return DefWindowProc(hwnd, message, wParam, lParam);
       }
    
    

  2. Register a minimum window class, DummyClass, that uses DummyWndProc as the class procedure. Specify the application's icon as the class icon.

  3. Create an invisible pop-up window of class DummyClass. Specify the application's name for the window caption text. Optionally, the coordinates for this invisible window can specify a location off the screen.

  4. In the CreateWindow call for the top-level visible window, specify the window from step 3 as the hwndParent parameter.

There is one caveat to using this method. If an application uses PostMessage with the hwnd parameter set to -1 to post a message to all applications, the invisible pop-up window will receive the message. If the application depends on any globally posted message, it is necessary to modify the DummyWndProc code above.


Additional reference words: 3.00 3.10
KBCategory: kbprg
KBSubcategory: UsrWndw
Keywords : kb16bitonly


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 23, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.