SAMPLE: Sample Demonstrates Read-Only Pop-Up Window w/ Shadow

Last reviewed: February 15, 1996
Article ID: Q104792
The information in this article applies to:
  • Microsoft Windows Software Development Kit (SDK) for Windows versions 3.0 and 3.1

SUMMARY

The Microsoft Windows SDK "The Windows Interface: An Application Design Guide" version 3.1 manual describes a read-only pop-up text field as a text field that, when clicked with the mouse, displays a read-only pop-up window containing additional information.

ROPOPUP is a file in the Microsoft Software Library that demonstrates how to implement such a read-only pop-up window to display text. The sample also demonstrates how to add a shadow to this read-only pop-up window.

Download ROPOPUP.EXE, 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 ROPOPUP.EXE (size: 25489 bytes) 
    
  • Internet (anonymous FTP)

          ftp ftp.microsoft.com
          Change to the \SOFTLIB\MSLFILES directory
          Get ROPOPUP.EXE (size: 25489 bytes) 
    

MORE INFORMATION

In the ROPOPUP sample, a button is used to invoke the read-only pop-up window. The read-only pop-up window is merely a pop-up window that has no nonclient areas (caption, system menu, menu, minimize/maximize buttons, sizing border, and so forth). Text is displayed on the main part of the pop-up window's client area. A shadow is displayed on the bottom and right sides of the client area.

Achieving the shadow effect requires several steps:

  1. Set the read-only pop-up window class's brush to a NULL_BRUSH.

    NOTE: The NULL_BRUSH is retrieved via GetStockObject(NULL_BRUSH). The effect is that the pop-up window will be entirely invisible. This step is needed in order to allow the shadow to be partially transparent.

  2. In the WM_CREATE message case for the pop-up window, create the shadow brush pattern. The shadow's pattern is defined by a monochrome bitmap with alternating black and white pixels.

  3. In the WM_PAINT message case for the pop-up window, three things need to be done:

    a. Fill the nonshadow area of the pop-up Window using the Rectangle

          function.
    

    b. Output the read-only text on the nonshadow area.

    c. Paint the shadow using PatBlt with ROP code 0xA000C9 to combine

          the shadow pattern and the background. For each black pixel in
          the pattern, this ROP code puts a black pixel on the screen. For
          each white pixel in the pattern, the existing screen pixel is
          left untouched. The end result is a shadow-like effect that
          allows the background to partially show through the shadow.
    

The read-only pop-up window is terminated by any mouse button or keyboard input. Because all the output for the pop-up window is done in its client area, no special screen cleanup is needed. Windows automatically refreshes what lies beneath the pop-up window.


Additional reference words: 3.00 3.10 shadow effect softlib ROPOPUP.EXE
KBCategory: kbprg kbfile
KBSubcategory: GdiDrw


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: February 15, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.