Kill the Windowz Close Button (X)
This subroutine will disable the Windows 9x/NT ' close button, also known as the little X ' button. It's really useful when you have a ' form that you don't want to set its ControlBox ' property to False. Write this code in a ' standard module (BAS).
AI
AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Source Code
Public Sub KillCloseButton(hWnd As Long) Dim hSysMenu As Long hSysMenu = GetSystemMenu(hWnd, 0) Call RemoveMenu(hSysMenu, 6, MF_BYPOS) Call RemoveMenu(hSysMenu, 5, MF_BYPOS) End Sub 'Call the above function from a form as it's being loaded Private Sub Form_Load() KillCloseButton Me.hWnd End Sub
Original Comments (3)
Recovered from Wayback Machine