You can turn off the minimize and maximize menu options by changing properties, but what if you're doing something critical in your VB program that should not be interrupted and you need to remove the "close" option?
Make the following declares:
Declare Function GetSystemMenu Lib "User" (ByVal hWnd As Integer, ByVal bRevert As Integer) As Integer
Declare Function RemoveMenu Lib "User" (ByVal hMenu As Integer, ByVal nPosition As Integer, ByVal wFlags As Integer) As Integer
Global Const MF_BYPOSITION=&H400
Use the following in your code to remove the "close" option:
SystemMenu% = GetSystemMenu (hWnd, 0)
Res% = RemoveMenu(SystemMenu%,6, MF_BYPOSITION)
Res% = RemoveMenu(SystemMenu%,6, MF_BYPOSITION) 'also remove the separator line
Check out the GetMenuID and InsertMenu API functions to do more complicated tasks.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.