Anyone know how to set the property or how to disable the "x" to close in a dialog box. I would just like it disabled and still showing!!!
Printable View
Anyone know how to set the property or how to disable the "x" to close in a dialog box. I would just like it disabled and still showing!!!
No problem just put this code in your form
then type DisableMenu to disable the cross and EnableMenu to enable it againCode:
Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
Private Declare Function ModifyMenu Lib "user32" Alias "ModifyMenuA" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long, ByVal wIDNewItem As Long, ByVal lpString As Any) As Long
Private Const MF_BYCOMMAND = &H0&
Private Const MF_GRAYED = &H1&
Private Const MF_ENABLED = &H0&
Private Const SC_CLOSE = &HF060&
Private Const FOOLVB = -10
Private Sub DisableMenu()
ModifyMenu GetSystemMenu(Me.hwnd, 0), SC_CLOSE, MF_BYCOMMAND Or MF_GRAYED, FOOLVB, "Close"
End Sub
Private Sub EnableMenu()
ModifyMenu GetSystemMenu(Me.hwnd, 0), SC_CLOSE, MF_BYCOMMAND Or MF_ENABLED, SC_CLOSE, "Close"
End Sub
I don't know how much experience you have had with the API but make sure you put the Declare statements and constants at the top of the code otherwise it won't work
Hope this helps
You crank thanks that's what iv'e been lookin for ya made me so happy :)
Okay what's the code to disable the maximize; i tried tweeking a little to no avail; thanks in advance!!! :)
to disable the maximize button, you just set the
MaxButton property to false. If your next question is
disabing the Min button, you just set the MinButton
property to false.
Right I know about the maximize and minimize property but i wanted to try and do it like the previous example using an api call. How do i change the code in the first answer to get the same result of the close but with the maximize button.