VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

Disable 'X' on Forms (Including MDI Child Forms)

Mark Troutwine  (1 Submission)   Windows API Call/Explanation   Visual Basic 3.0   Unknown Difficulty   Wed 3rd February 2021

This is shorter way to disable the 'X' or close button on a form. It also works on MDI Child forms also which I have found most other code does not.

Inputs
None.

Assumes
Just copy and paste it as stated below!

Returns
None.

Side Effects
None.

API Declarations
' Place this in a module:
Public Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
Public Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Public Const SC_CLOSE = &HF060&
Public Const MF_BYCOMMAND = &H0&

Rate Disable 'X' on Forms (Including MDI Child Forms) (14(14 Vote))
Disable 'X' on Forms (Including MDI Child Forms).bas

Disable 'X' on Forms (Including MDI Child Forms) Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters