Visual Basic > API and Miscellaneous
How to remove Control Box menu items.
How to remove Control Box menu items. 'Note: This has only been tested with VB 3 & VB 4-16, if you convert ' Declare these API's and constant Declare Function GetSystemMenu% Lib "User" (ByVal hWnd%, ByVal bRevert%) Declare Function RemoveMenu% Lib "User" (ByVal hMenu%, ByVal nPosition%, ByVal wFlags%) Global Const MF_BYPOSITION = &H400 ' This procedure modifies the control menu for a dialog box. ' The form must have the MinButton and MaxButton set ' to false if you leave the ControlBox property set to true. ' Otherwise, Restore, Maximize, and Minimize will stay on... Dim hSysMenu%, suc% ' Obtain the handle to the forms System menu hSysMenu% = GetSystemMenu(fm.hWnd, False) ' Remove all but the MOVE and CLOSE options. ' The menu items must be removed starting with ' the last menu item. suc% = RemoveMenu(hSysMenu, 8, MF_BYPOSITION) 'Switch to suc% = RemoveMenu(hSysMenu, 7, MF_BYPOSITION) 'Separator suc% = RemoveMenu(hSysMenu, 5, MF_BYPOSITION) 'Separator
Visual Basic Codes
ActiveX
Miscellaneous
Applications
Code Snippets
Common Dialogs
Special Effects
Database Stuff
Date Time
Files Drives
Forms
Graphics Games
Internet Stuff
Multimedia
Other
Strings
Windows