SAMPLE: NoTitle.exe - Adding and Removing Caption of a Window

ID: Q83915

The information in this article applies to:

SUMMARY

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

MORE INFORMATION

The following file is available for download from the Microsoft Software Library:

 ~ NoTitle.exe (size: 21939 bytes) 

For more information about downloading files from the Microsoft Software Library, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q119591
   TITLE : How to Obtain Microsoft Support Files from Online Services

In the NoTitle.exe 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.exe 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.exe 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 query words: Keywords : kbfile kbsample kb16bitonly kbGrpUser kbWinOS310 kbWndw kbWndwProp kbWinOS300

Last Reviewed: December 17, 1998