Results 1 to 4 of 4

Thread: Disable MDIForm 'X'

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jun 2002
    Location
    South West UK
    Posts
    245

    Disable MDIForm 'X'

    How can i disable the 'X' at the top right hand corner of an MDI Form?
    A lowly programmer.

    http://www.sentinalgroup.com

  2. #2
    Not NoteMe SLH's Avatar
    Join Date
    Mar 2002
    Location
    192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
    Posts
    3,051
    I'm not sure if you can actually remove it, but you should be able to stop it working...

    VB Code:
    1. Private Sub MDIForm_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    2.     If UnloadMode = 0 then Cancel = 1
    3. End Sub

    If unloadmode is 0 then the form's trying to close because the user clicked on the close button.
    Quotes:
    "I am getting better then you guys.." NoteMe, on his leet english skills.
    "And I am going to meat her again later on tonight." NoteMe
    "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
    "my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
    Have I helped you? Please Rate my posts.


  3. #3
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    VB Code:
    1. Option Explicit
    2.  
    3. Private Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Long, _
    4.                                                   ByVal nPosition As Long, _
    5.                                                   ByVal wFlags As Long) _
    6.                                                   As Long
    7. Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, _
    8.                                                      ByVal bRevert As Long) _
    9.                                                      As Long
    10.  
    11. Private Const MF_BYCOMMAND = &H0&
    12. Private Const SC_CLOSE = &HF060&
    13.  
    14. Private Sub MDIForm_Load()
    15. Dim hMnu As Long
    16.  
    17.     hMnu = GetSystemMenu(Me.hwnd, False)
    18.     Call RemoveMenu(hMnu, SC_CLOSE, MF_BYCOMMAND)
    19.  
    20. End Sub
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  4. #4
    PowerPoster Deepak Sakpal's Avatar
    Join Date
    Mar 2002
    Location
    Mumbai, India
    Posts
    2,424
    its too good man

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width