Results 1 to 6 of 6

Thread: DeleteMenu API and maximum probl.

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 1999
    Location
    Garden Grove, CA, USA
    Posts
    110
    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.
    ngphuocthinh

  2. #2
    Guest
    This code is from Megatron which will allow you to disable the x button.

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

  3. #3
    Fanatic Member
    Join Date
    Feb 2000
    Location
    The Netherlands
    Posts
    715
    Originally posted by Matthew Gates
    Code:
        RemoveMenu GetSystemMenu(hWnd, 0), 6, MF_BYPOSITION 'Disable Close
    [/B]
    Why is that line green?
    Oetje
    [email protected]
    93606776
    Visual Basic 6, Windows 2000

    Never pet a burning dog

  4. #4
    Guest
    Remove
    Rem

    ^Color coding

    Code:
    Rem
    Code:
    Remove
    Code:
    RemoveMenu
    Code:
    RemoveMenu ()
    Code:
    Remove Function()
    Code:
    RemoveMenu GetSystemMenu(hWnd, 0), 6, MF_BYPOSITION
    Code:
    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 .

  5. #5
    Guest
    Code:
    Private Sub Form_Load()
    RemoveMenu GetSystemMenu(hWnd, 0), 6, MF_BYPOSITION 'Disable Close
    End Sub
    Code:
    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.

    Code:
    Private Sub Form_Load()
    RemoveMenu GetSystemMenu(hWnd, 0), 6, MF_BYPOSITION
    Code:
    RemoveMenu GetSystemMenu(hWnd, 0), 6, MF_BYPOSITION
    End Sub
    Sorry for the useless posting, but this cannot remain an unsolved mystery .


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

    Code:
    Private
    RemoveMenu GetSystemMenu(hWnd, 0), 6, MF_BYPOSITION
    Code:
    Sub
    RemoveMenu GetSystemMenu(hWnd, 0), 6, MF_BYPOSITION

  6. #6
    Guest
    I believe Vb-World this of Remove as Rem which is equal to ' (used for commenting).
    Code:
    Private Sub Command1_Click()
    
        Rem This is a comment
        
    End Sub

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