|
-
Jun 16th, 2008, 10:19 AM
#1
Thread Starter
Member
[VB6] Restrict the maximize button?
I would like to be able to stop users maximising a form. Can anyone point me to an article or post some code that would allow me to "Grey" it out?
Regards
James Roche
-
Jun 16th, 2008, 10:25 AM
#2
Re: [VB6] Restrict the maximize button?
Wouls this work for you?
Code:
Option Explicit
Private Const GWL_STYLE = (-16)
Private Const WS_MAXIMIZEBOX = &H10000
Private Const WS_THICKFRAME = &H40000
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
Private Sub Form_Load()
'=======================
Dim hMenu As Long
Dim lStyle As Long
'disable MAXIMIZE button
lStyle = GetWindowLong(Me.hwnd, GWL_STYLE)
lStyle = lStyle And Not WS_MAXIMIZEBOX
Call SetWindowLong(Me.hwnd, GWL_STYLE, lStyle)
'uncomment the following block if you need to make form not resizeable
' lStyle = GetWindowLong(Me.hwnd, GWL_STYLE)
' lStyle = lStyle And Not WS_THICKFRAME
' Call SetWindowLong(Me.hwnd, GWL_STYLE, lStyle)
End Sub
-
Jun 16th, 2008, 10:36 AM
#3
PowerPoster
Re: [VB6] Restrict the maximize button?
Why can't you set the maximize property (of the form) to False?
===================================================
If your question has been answered, mark the thread as [RESOLVED]
-
Jun 16th, 2008, 10:40 AM
#4
Re: [VB6] Restrict the maximize button?
 Originally Posted by Pasvorto
Why can't you set the maximize property (of the form) to False?
If you meant to say MaxButton then of course that would work too but only if don't need to change it again.
For toggling (True/Fals) Max/Min/Close buttons you'll have to use Windows APIs.
-
Jun 16th, 2008, 10:42 AM
#5
PowerPoster
Re: [VB6] Restrict the maximize button?
I just took it as a "blanket" can't maximize the form. I may have misunderstood.
===================================================
If your question has been answered, mark the thread as [RESOLVED]
-
Jun 16th, 2008, 11:12 AM
#6
Re: [VB6] Restrict the maximize button?
I just disable the maximize button of the form in design.
-
Jun 16th, 2008, 01:12 PM
#7
Re: [VB6] Restrict the maximize button?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jun 16th, 2008, 05:34 PM
#8
Thread Starter
Member
Re: [VB6] Restrict the maximize button?
Lol, i didnt realise the form has a max button property, thats done the trick. Thanks guys
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|