|
-
Mar 16th, 2000, 05:10 AM
#1
Thread Starter
Addicted Member
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!!!
-
Mar 16th, 2000, 06:06 AM
#2
Frenzied Member
No problem just put this code in your form
Code:
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
then type DisableMenu to disable the cross and EnableMenu to enable it again
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
-
Mar 16th, 2000, 06:28 AM
#3
Thread Starter
Addicted Member
You crank thanks that's what iv'e been lookin for ya made me so happy
-
Mar 16th, 2000, 06:54 AM
#4
Thread Starter
Addicted Member
Okay what's the code to disable the maximize; i tried tweeking a little to no avail; thanks in advance!!!
-
Mar 16th, 2000, 08:03 AM
#5
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.
-
Mar 16th, 2000, 12:36 PM
#6
Thread Starter
Addicted Member
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|