If you would like to get paid for surfing the web, jump to http://www.codeoftheweek.com/paidsurf.html
Want to get up to speed on the latest Visual Basic programming? Includes Visual Basic 6 and Visual InterDev 6. Check out our training programs at http://www.codeoftheweek.com/vbtraining.html
In this issue we discuss how to remove items from the system menu.
If you have any questions about using this module, let us know at questions@codeoftheweek.com
The basFormUtils module contains a method which allows you to remove any option from the system menu of a Visual Basic form. It provides these features using two API calls: GetSystemMenu and RemoveMenu. The GetSystemMenu retrieves the handle to the system menu of the specified window. The RemoveMenu call is the one that actually removes the menu item from the menu.
Public Sub RemoveSystemMenu(ByVal frm As Form, ByVal eMenu As enumMenuType)
This method will remove the system menu item on the form specified by frm. The menu item is defined by the enumerator enumMenuType. The valid choices for eMenu are mtMove, mtSize, mtMinimize, mtMaximize, mtClose, mtRestore. Each enumerator will remove the associated menu option. For example, if you specify the mtMove enumerator it will remove the Move option from the system menu.
The below sample shows how to call the RemoveSystemMenu method with various options. In this particular example it will remove the maximize, restore and size options from the system menu. You would typically call this method from the Form_Load method within your form.
Private Sub Form_Load() RemoveSystemMenu Me, mtMaximize RemoveSystemMenu Me, mtSize RemoveSystemMenu Me, mtRestore End Sub
To see the source code for this issue you must be a subscriber to Code of the Week. If you are a subscriber the source code is available at the following address: http://www.codeoftheweek.com/membersonly/bi/0108.html
If you would like to get paid for surfing the web, jump to http://www.codeoftheweek.com/paidsurf.html