Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21089

[ASK]Remove or Disable Menu on MDI Form Icon

$
0
0
hi..
can i now how to disable or remove the menu on MDI Form icon?
Name:  MDI.jpg
Views: 120
Size:  18.9 KB

i use this code but this code just disable MAX Button on MDi Form
code from http://www.vbforums.com/showthread.p...=1#post2208777
Code:

Private Declare Function GetSystemMenu Lib "user32.dll" ( ByVal hWnd As Long, ByVal bRevert As Long) As Long
 Private Declare Function DeleteMenu Lib "user32.dll" ( ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
 Private Declare Function DrawMenuBar Lib "user32.dll" (ByVal hWnd As Long) As Long
 
 Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
 Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
 
Public Sub RemoveSizingButton(ByVal hWnd As Long)
 
    Const WS_MAXIMIZEBOX                As Long = &H10000
    Const MF_BYPOSITION                  As Long = &H400&
    Const MF_BYCOMMAND                  As Long = &H0&
    Const SC_MAXIMIZE                    As Long = &HF030
    Const SC_SIZE                        As Long = &HF000
    Const SW_HIDE                        As Long = 0
    Const GWL_STYLE = (-16)
    Const WS_THICKFRAME As Long = &H40000
   
    Dim lStyle          As Long
    Dim hwndMenu        As Long
       
    lStyle = GetWindowLong(hWnd, GWL_STYLE)
    lStyle = lStyle And Not (WS_THICKFRAME Or WS_MAXIMIZEBOX)
    SetWindowLong hWnd, GWL_STYLE, lStyle
 
    'deletting Menu
    hwndMenu = GetSystemMenu(hWnd, False)
    lStyle = DeleteMenu(hwndMenu, SC_MAXIMIZE, MF_BYCOMMAND)         
    lStyle = DeleteMenu(hwndMenu, SC_SIZE, MF_BYCOMMAND)             
    lStyle = DrawMenuBar(hWnd)
 
End Sub


Private Sub MDIForm_Load()
    RemoveSizingButton Me.hWnd
End Sub

thanks b4
Attached Images
 

Viewing all articles
Browse latest Browse all 21089

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>