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

ID: Q110498


The information in this article applies to:


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:
This information is subject to change.

Additional query words: 3.00


Keywords          : kb3rdparty kbref 
Version           : 3.00
Platform          : WINDOWS 
Issue type        : 

Last Reviewed: June 9, 1999