SAMPLE: Adding and Removing Caption of a Window

Last reviewed: April 7, 1997
Article ID: Q83915
3.00 3.10 WINDOWS kbprg kbfile

The information in this article applies to:

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

SUMMARY

NOTITLE is a file in the Microsoft Software Library that demonstrates adding and removing the title (caption) of a window.

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

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

MORE INFORMATION

In the NOTITLE sample, when the window has a caption and the user selects NoTitle from the main menu, the caption is removed. When the user double- clicks the window without a caption by using the left mouse button, the caption is added to the window.

NOTITLE removes the caption by performing the following five steps:

  1. Removes the menu from the window by calling the SetMenu() function with NULL as the hMenu parameter.

  2. Retrieves the current window style by calling GetWindowLong with GWL_STYLE as the nIndex parameter.

  3. Removes the caption bit.

  4. Calls SetWindowLong() with GWL_STYLE to change the style of the window.

  5. Calls InvalidateRect() to instruct the application to redraw the window.

NOTITLE places the caption on the window by performing the following five steps:

  1. Adds the menu to the window by calling the SetMenu() function with the menu handle as the hMenu parameter.

  2. Retrieves the current window style by calling GetWindowLong() with GWL_STYLE as the nIndex parameter.

  3. Adds the caption bit.

  4. Calls SetWindowLong() with GWL_STYLE to change the style of the window.

  5. Calls InvalidateRect() to instruct the application to redraw the window.


Additional reference words: 3.00 3.10 softlib NOTITLE.EXE
KBCategory: kbprg kbfile
KBSubcategory: UsrWndw
Keywords : UsrWndw kbfile kbprg
Version : 3.00 3.10
Platform : 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: April 7, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.