VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

Kill the Windowz Close Button (X)

Jonathan Smith  (13 Submissions)   Custom Controls/Forms/Menus   Visual Basic 3.0   Unknown Difficulty   Wed 3rd February 2021

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).

Assumes
Should be familiar with the Windows API.

Side Effects
If you're playing around with the system ' menu in other ways in your program, you ' might have to change the position number ' in your RemoveMenu function calls. Also, ' you could have problems running this ' with a MDI child.

API Declarations
Private Declare Function GetSystemMenu Lib "user32" _
(ByVal hWnd As Long, ByVal bRevert As Long) As Long
Private Declare Function RemoveMenu Lib "user32" _
(ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Private Const MF_BYPOS = &H400&

Rate Kill the Windowz Close Button (X) (7(7 Vote))
Kill the Windowz Close Button (X).bas

Kill the Windowz Close Button (X) Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters