I've used DeleteMenu to delete the X button for my MDI-child form. But when it comes to Maximized the MDI-child form a person can still close the form when they cliked on the disabled X button.
Printable View
I've used DeleteMenu to delete the X button for my MDI-child form. But when it comes to Maximized the MDI-child form a person can still close the form when they cliked on the disabled X button.
This code is from Megatron which will allow you to disable the x button.
Code:Private Declare Function GetSystemMenu Lib "User32" _
(ByVal hWnd As Integer, ByVal bRevert As Integer) As Integer
Private Declare Function RemoveMenu Lib "User32" (ByVal _
hMenu As Integer, ByVal nPosition As Integer, ByVal wFlags _
As Integer) As Integer
Const MF_BYPOSITION = &H400
Private Sub Form_Load()
RemoveMenu GetSystemMenu(hWnd, 0), 6, MF_BYPOSITION 'Disable Close
End Sub
Why is that line green?Quote:
Originally posted by Matthew Gates
[/B]Code:RemoveMenu GetSystemMenu(hWnd, 0), 6, MF_BYPOSITION 'Disable Close
Remove
Rem
^Color coding
Code:Rem
Code:Remove
Code:RemoveMenu
Code:RemoveMenu ()
Code:Remove Function()
Code:RemoveMenu GetSystemMenu(hWnd, 0), 6, MF_BYPOSITION
Code:RemoveMenu GetSystemMenu(hWnd, 0), 6, MF_BYPOSITION 'Disable Close
This was brought up by Yonatan to John in the Feedback Forums.
Try searching for it if you really want to know more :rolleyes:.
Code:Private Sub Form_Load()
RemoveMenu GetSystemMenu(hWnd, 0), 6, MF_BYPOSITION 'Disable Close
End Sub
There we go, it is either one of theses lines:Code:Private Sub Form_Load()
RemoveMenu GetSystemMenu(hWnd, 0), 6, MF_BYPOSITION
End Sub
Private Sub Form_Load()
or
End Sub.
Code:Private Sub Form_Load()
RemoveMenu GetSystemMenu(hWnd, 0), 6, MF_BYPOSITION
Sorry for the useless posting, but this cannot remain an unsolved mystery :rolleyes:.Code:RemoveMenu GetSystemMenu(hWnd, 0), 6, MF_BYPOSITION
End Sub
And Private Sub Form_Load(), it is! Mystery Solved--Half way.
Code:Private
RemoveMenu GetSystemMenu(hWnd, 0), 6, MF_BYPOSITION
Code:Sub
RemoveMenu GetSystemMenu(hWnd, 0), 6, MF_BYPOSITION
I believe Vb-World this of Remove as Rem which is equal to ' (used for commenting).
Code:Private Sub Command1_Click()
Rem This is a comment
End Sub