Adding Items to the System Menus of All Applications

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

SUMMARY

ADMENU.ZIP is a code sample on the Software/Data library that demonstrates adding new menu items to the system menus of all applications running under Windows at a given time.

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

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

MORE INFORMATION

ADMENUAPP adds two menu items to the system menu of each application running under Windows. To do this, it uses two system-wide hooks: a WH_GETMESSAGE hook and a WH_CALLWNDPROC hook. Both of these hooks are implemented in ADMENULIB, a fixed-code DLL.

Whenever the WH_CALLWNDPROC hook function sees a WM_INITMENU message being sent to a top-level window, it appends the two new menu items to that window's system menu. The items are removed when the menu is closed.

The two menu items that are added appear as "New Menu Item 1" and "New Menu Item 2." If the user selects one of these items, the WH_GETMESSAGE hook procedure sees the resulting WM_COMMAND message and responds by posting a private message to ADMENUAPP. ADMENUAPP handles the private message by displaying a dialog box stating that one of the two added items was selected.

For more information on adding menu items to another application's system menu, please see the following article(s) in the Microsoft Knowledge Base:

ARTICLE-ID: Q72222

TITLE     : Appending Menu Items to Other Applications


Additional reference words: 3.00 3.10 softlib
KBCategory: kbprg kbfile
KBSubcategory: UsrMen


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.