PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
removing max button on mdi parent-VBForums
Results 1 to 3 of 3

Thread: removing max button on mdi parent

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    removing max button on mdi parent

    search gave me no luck so can anyone tell me how to remove the max button within an mdi parent? the max button on the top right of the form.

    thanks in advance.

  2. #2
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,728

    Re: removing max button on mdi parent

    I have just writen this code. Works on WinXP-SP2. Haven't tested on other platform:
    VB Code:
    1. 'Inside MDIForm
    2. Option Explicit
    3.  
    4. Private Declare Function GetSystemMenu Lib "user32" _
    5.                             (ByVal hWnd As Long, _
    6.                             ByVal bRevert As Long) As Long
    7.  
    8. Private Declare Function DeleteMenu Lib "user32" _
    9.                             (ByVal hMenu As Long, _
    10.                             ByVal nPosition As Long, _
    11.                             ByVal wFlags As Long) As Long
    12.  
    13. Private Declare Function DrawMenuBar Lib "user32" _
    14.                             (ByVal hWnd As Long) As Long
    15.  
    16. Private Declare Function GetWindowLong Lib _
    17.                  "user32" Alias "GetWindowLongA" (ByVal hWnd _
    18.                  As Long, ByVal nIndex As Long) As Long
    19.  
    20. Private Declare Function SetWindowLong Lib _
    21.                 "user32" Alias "SetWindowLongA" (ByVal hWnd _
    22.                   As Long, ByVal nIndex As Long, ByVal dwNewLong _
    23.                  As Long) As Long
    24.  
    25. Private Const MF_BYCOMMAND = &H0
    26. Private Const SC_MAXIMIZE As Long = &HF030&
    27.  
    28. Private Const GWL_STYLE& = (-16)
    29. Private Const WS_MAXIMIZEBOX As Long = &H10000
    30.  
    31. '=================================================================
    32. Private Sub MDIForm_Load()
    33.  
    34.     DisableMaxButton
    35.  
    36. End Sub
    37.  
    38. '=================================================================
    39. Public Sub DisableMaxButton()
    40.  
    41.     'This sub Removes Maximize button from control box and system menu.
    42.     Dim hMenu As Long
    43.     Dim OldStyle As Long
    44.  
    45.     'Remove Max button
    46.     OldStyle = GetWindowLong(Me.hWnd, GWL_STYLE)
    47.     SetWindowLong Me.hWnd, GWL_STYLE, OldStyle And (Not WS_MAXIMIZEBOX)
    48.        
    49.     'Remove from system menu
    50.     hMenu = GetSystemMenu(Me.hWnd, 0&)
    51.  
    52.     If hMenu Then
    53.         Call DeleteMenu(hMenu, SC_MAXIMIZE, MF_BYCOMMAND)
    54.         Call DrawMenuBar(Me.hWnd)
    55.        
    56.     End If
    57.  
    58. End Sub
    Last edited by iPrank; Jan 8th, 2006 at 04:02 PM.
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: removing max button on mdi parent

    thanks for the code. will have to test it on other platforms too. and will get back to you.

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width