Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact


min max disable


min max disable

Author
Message
jackryan
jackryan
Forum God
Forum God (12K reputation)Forum God (12K reputation)Forum God (12K reputation)Forum God (12K reputation)Forum God (12K reputation)Forum God (12K reputation)Forum God (12K reputation)Forum God (12K reputation)Forum God (12K reputation)

Group: Forum Members
Posts: 95, Visits: 102
hello,



with my apps, i'm trying to disable min max button or if possible hide them. ive tried several suggestion but nothing seems to work for me, can somebody help me? thankss


jack ryan





Let your plans be dark and impenetrable as night, and when you move, fall like a thunderbolt. - Sun Tzu
Keithuk
Keithuk
Forum God
Forum God (291K reputation)

Group: Moderators
Posts: 1.9K, Visits: 5.5K
I presume you mean the Form's Min and Max buttons. Look at the Form properties for MaxButton and MinButton and set them to False. Wink

Keith

I've been programming with VB for 17 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.

jackryan
jackryan
Forum God
Forum God (12K reputation)Forum God (12K reputation)Forum God (12K reputation)Forum God (12K reputation)Forum God (12K reputation)Forum God (12K reputation)Forum God (12K reputation)Forum God (12K reputation)Forum God (12K reputation)

Group: Forum Members
Posts: 95, Visits: 102
i'm sorry if i haven't been clear on my first post, i mean to say min-max button of mdi parent. i've tried several suggestion but nothing seems to work for me

jack ryan





Let your plans be dark and impenetrable as night, and when you move, fall like a thunderbolt. - Sun Tzu
Sunil KC
Sunil KC
Forum God
Forum God (18K reputation)Forum God (18K reputation)Forum God (18K reputation)Forum God (18K reputation)Forum God (18K reputation)Forum God (18K reputation)Forum God (18K reputation)Forum God (18K reputation)Forum God (18K reputation)

Group: Forum Members
Posts: 209, Visits: 145
for disable Max button, here is some code

'Declaration in Form Level
Private Declare Function GetSystemMenu Lib "user32" _
    (ByVal hwnd As Long, _
     ByVal bRevert As Long) As Long

Private Declare Function RemoveMenu Lib "user32" _
    (ByVal hMenu As Long, _
     ByVal nPosition As Long, _
     ByVal wFlags As Long) As Long
Const MF_BYPOSITION = &H400&

Public Sub DisableCloseWindowButton(frm As Form)
    Dim hSysMenu As Long
    hSysMenu = GetSystemMenu(frm.hwnd, 0)
    RemoveMenu hSysMenu, 6, MF_BYPOSITION
    RemoveMenu hSysMenu, 5, MF_BYPOSITION
End Sub

Private Sub MDIForm_Load()
    DisableCloseWindowButton Me
End Sub



____________
Sunil KC
http://www.sunil.com.np

jackryan
jackryan
Forum God
Forum God (12K reputation)Forum God (12K reputation)Forum God (12K reputation)Forum God (12K reputation)Forum God (12K reputation)Forum God (12K reputation)Forum God (12K reputation)Forum God (12K reputation)Forum God (12K reputation)

Group: Forum Members
Posts: 95, Visits: 102
thanks for your reply but it also didn't work

jack ryan





Let your plans be dark and impenetrable as night, and when you move, fall like a thunderbolt. - Sun Tzu
Sunil KC
Sunil KC
Forum God
Forum God (18K reputation)Forum God (18K reputation)Forum God (18K reputation)Forum God (18K reputation)Forum God (18K reputation)Forum God (18K reputation)Forum God (18K reputation)Forum God (18K reputation)Forum God (18K reputation)

Group: Forum Members
Posts: 209, Visits: 145
Oh, sorry above code works for disable close button.

____________
Sunil KC
http://www.sunil.com.np

Othor
Othor
Forum God
Forum God (22K reputation)Forum God (22K reputation)Forum God (22K reputation)Forum God (22K reputation)Forum God (22K reputation)Forum God (22K reputation)Forum God (22K reputation)Forum God (22K reputation)Forum God (22K reputation)

Group: Forum Members
Posts: 272, Visits: 604
Remove Min/Max Buttons From MDI Form
'Remove Min/Max Buttons From MDI Form
'Unlike other forms, MDI forms don't have MinButton and MaxButton
'properties to enable or disable the form's Minimize and Maximize buttons.
'If you add this code to an MDI parent form's Load event, it disables the
'Minimize and Maximize buttons on the MDI form. If you just want to disable
'one or the other, comment out the appropriate line, based on which constant
'you don't need:
 
Sub MDIForm_Load()
    Dim lWnd As Long
    lWnd = GetWindowLong(Me.hwnd, GWL_STYLE)
    lWnd = lWnd And Not (WS_MINIMIZEBOX)
    lWnd = lWnd And Not (WS_MAXIMIZEBOX)
    lWnd = SetWindowLong(Me.hwnd, GWL_STYLE, lWnd)
End Sub
Add this code (which includes the required API declarations) to a BAS module:
 
#If Win32 Then
    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
#Else
    Declare Function SetWindowLong Lib "User" (ByVal hwnd _
        As Integer, ByVal nIndex As Integer, ByVal _
        dwNewLong As Long) As Long
    Declare Function GetWindowLong Lib "User" (ByVal hwnd _
        As Integer, ByVal nIndex As Integer) As Long
#End If
Const WS_MINIMIZEBOX = &H20000
Const WS_MAXIMIZEBOX = &H10000
Const GWL_STYLE = (-16)



KlinerDraken
http://new.kd-radio.com
Edited
5/30/2006 by KlinerDraken
jackryan
jackryan
Forum God
Forum God (12K reputation)Forum God (12K reputation)Forum God (12K reputation)Forum God (12K reputation)Forum God (12K reputation)Forum God (12K reputation)Forum God (12K reputation)Forum God (12K reputation)Forum God (12K reputation)

Group: Forum Members
Posts: 95, Visits: 102
kliner, thanks for your response, i placed your code on my mdi form and only the min button is working, the max button is still not working, can you please help me more? thanks

jack ryan





Let your plans be dark and impenetrable as night, and when you move, fall like a thunderbolt. - Sun Tzu
Sunil KC
Sunil KC
Forum God
Forum God (18K reputation)Forum God (18K reputation)Forum God (18K reputation)Forum God (18K reputation)Forum God (18K reputation)Forum God (18K reputation)Forum God (18K reputation)Forum God (18K reputation)Forum God (18K reputation)

Group: Forum Members
Posts: 209, Visits: 145
Nice job Smile

____________
Sunil KC
http://www.sunil.com.np

Sunil KC
Sunil KC
Forum God
Forum God (18K reputation)Forum God (18K reputation)Forum God (18K reputation)Forum God (18K reputation)Forum God (18K reputation)Forum God (18K reputation)Forum God (18K reputation)Forum God (18K reputation)Forum God (18K reputation)

Group: Forum Members
Posts: 209, Visits: 145
But it works for me. I have used following code

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
Const WS_MINIMIZEBOX = &H20000
Const WS_MAXIMIZEBOX = &H10000
Const GWL_STYLE = (-16)

Private Sub MDIForm_Load()
    Dim lWnd As Long
    lWnd = GetWindowLong(Me.hwnd, GWL_STYLE)
    lWnd = lWnd And Not (WS_MINIMIZEBOX)
    lWnd = lWnd And Not (WS_MAXIMIZEBOX)
    lWnd = SetWindowLong(Me.hwnd, GWL_STYLE, lWnd)
End Sub



____________
Sunil KC
http://www.sunil.com.np

GO


Similar Topics


Reading This Topic


Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....

















A1VBCode Forums


Search