How to Add Items into Control Menu Box of Visual Basic Form

Last reviewed: February 18, 1996
Article ID: Q110498
The information in this article applies to:

- Standard and Professional Editions of Microsoft Visual Basic for

  Windows, version 3.0

SUMMARY

To add items into the Control-menu box of a Visual Basic Form, you can use the AppendMenu API (application programming interface) function in Windows. However, Visual Basic cannot directly detect any events for the added menu item. To catch the message for the added menu item, you can use a subclass control. You can write subclass controls using Microsoft C, but not using Visual Basic. Alternatively, you can obtain subclass controls from third- party programs such as SpyWorks from Desaware.

The Control-menu box, found in the upper-left corner of a Visual Basic form, is also known as the System-menu box in other products for Windows. The default Control-menu box contains the following nine entries including separators:

   Restore
   Move
   Size
   Minimize
   Maximize
   -----------------------
   Close            Alt+F4
   -----------------------
   Switch to...   Ctrl+Esc

MORE INFORMATION

In Windows programming terms, subclassing is the process of creating a message handling procedure and intercepting messages for a given window, handling any messages you choose, and passing the rest to the window's original message handler.

The subclass procedure is a message filter that performs nondefault processing for a few key messages, and passes other messages to a default window procedure using the CallWindowProc API function. The CallWindowProc function passes a message to the Windows system, which in turns sends the message to the target window procedure. The target window procedure cannot be called directly by the subclass procedure because the target procedure (in this case a window procedure) is exported.

How to Contact Desaware

NOTE: Desaware products are manufactured independent of Microsoft. Microsoft makes no warranty, implied or otherwise, regarding these products' performance or reliability.

   Desaware
   5 Town & Country Village #790
   San Jose, CA  95128
   Contact:  Dan Appleman (408) 377-4770
   Fax: (408) 371-3530

The Desaware company offers the following products:
  • Custom Control Factory -- An interactive development tool for creating custom controls including animated pushbuttons, multistate buttons, enhanced buttons, check boxes, and option button controls for Windows applications.
  • CCF-Cursors -- Provides you with complete control over cursors (mouse pointers) in Visual Basic applications. Create your own cursors or convert icons to cursors, and much more. Includes over 50 cursors.
  • SpyWorks-VB -- An advanced development tool for use with Visual Basic. SpyWorks contains subclass controls.

This information is subject to change.


Additional reference words: 3.00
KBCategory: kbref kbprg kb3rdparty
KBSubcategory: APrgOther RefsThird


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