Results 1 to 2 of 2

Thread: FYI - Closing the form option

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2000
    Posts
    303

    FYI - Closing the form option

    While I was having problem with the size form option,
    I accidentally turned the form's "ControlBox" to FALSE
    and I lost all of my Min, MAx and X option on the form.

    I remember someone was asking a long while ago about
    how to get rid of the X option on the form.

    So now u know the rest of the story.

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Cool

    Paste this code into a new project and
    add a command button. Then you can see an example of
    how to disable the 'x' (Grey it out).

    VB Code:
    1. Private Declare Function RemoveMenu Lib "user32" _
    2. (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
    3.  
    4. Private Declare Function GetSystemMenu Lib "user32" _
    5. (ByVal hwnd As Long, ByVal bRevert As Long) As Long
    6.  
    7. Private Const MF_BYPOSITION = &H400&
    8.  
    9. Private Sub Command1_Click()
    10.  
    11.     Unload Me
    12.  
    13. End Sub
    14.  
    15. Private Sub Form_Load()
    16.  
    17.     RemoveMenu GetSystemMenu(Me.hwnd, 0), 6, MF_BYPOSITION
    18.    
    19. End Sub

    i hope it helps. Later
    Last edited by RobDog888; Dec 31st, 2005 at 11:17 PM. Reason: Type-o

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