PDA

Click to See Complete Forum and Search --> : DeleteMenu API and maximum probl.


thinh
Nov 23rd, 2000, 01:31 AM
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.

Nov 23rd, 2000, 09:03 AM
This code is from Megatron which will allow you to disable the x button.

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

oetje
Nov 23rd, 2000, 09:49 AM
Originally posted by Matthew Gates

RemoveMenu GetSystemMenu(hWnd, 0), 6, MF_BYPOSITION 'Disable Close

[/B]
Why is that line green?

Nov 23rd, 2000, 10:59 AM
Remove
Rem

^Color coding

Rem

Remove

RemoveMenu

RemoveMenu ()

Remove Function()

RemoveMenu GetSystemMenu(hWnd, 0), 6, MF_BYPOSITION

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

Nov 23rd, 2000, 11:08 AM
Private Sub Form_Load()
RemoveMenu GetSystemMenu(hWnd, 0), 6, MF_BYPOSITION 'Disable Close
End Sub

Private Sub Form_Load()
RemoveMenu GetSystemMenu(hWnd, 0), 6, MF_BYPOSITION
End Sub

There we go, it is either one of theses lines:

Private Sub Form_Load()
or
End Sub.

Private Sub Form_Load()
RemoveMenu GetSystemMenu(hWnd, 0), 6, MF_BYPOSITION


RemoveMenu GetSystemMenu(hWnd, 0), 6, MF_BYPOSITION
End Sub

Sorry for the useless posting, but this cannot remain an unsolved mystery :rolleyes:.


And Private Sub Form_Load(), it is! Mystery Solved--Half way.

Private
RemoveMenu GetSystemMenu(hWnd, 0), 6, MF_BYPOSITION


Sub
RemoveMenu GetSystemMenu(hWnd, 0), 6, MF_BYPOSITION

Nov 23rd, 2000, 02:30 PM
I believe Vb-World this of Remove as Rem which is equal to ' (used for commenting).

Private Sub Command1_Click()

Rem This is a comment

End Sub