How to Add Items into Control Menu Box of Visual Basic FormID: Q110498
|
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
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.
Desaware
5 Town & Country Village #790
San Jose, CA 95128
Contact: Dan Appleman (408) 377-4770
Fax: (408) 371-3530
Additional query words: 3.00
Keywords : kb3rdparty kbref
Version : 3.00
Platform : WINDOWS
Issue type :
Last Reviewed: June 9, 1999