|
-
Apr 9th, 2000, 07:16 AM
#8
Thread Starter
Junior Member
Wrong Info on this thread
Although u can set the maxbutton property to false at design time, this only works with NON-MDI forms....for your MDI forms u have to do it in code using windows API functions....i looked up several in the API text viewer & the code below will show how to disable the Maximize button on an MDI form & also how to prevent resizing:
Code:
-----
In the General declartions of a Module
----------------------------------------
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 Const WS_THICKFRAME = &H40000
Private Const WS_MAXIMIZEBOX = &H10000
Private Const GWL_STYLE = (-16)
'This function will make sure the form that is passed to it
' thru its paramater has the Maximize button disabled & cannot
' be resized
Public Sub MaxBox(ByRef PsdForm As Form)
Dim lStyle As Long
lStyle = GetWindowLong(PsdForm.hwnd, GWL_STYLE)
lStyle = lStyle Xor WS_MAXIMIZEBOX Xor WS_THICKFRAME
Call SetWindowLong(PsdForm.hwnd, GWL_STYLE, lStyle)
End Sub
In the Load Event of the MDI form:
----------------------------------
Maxbox Me
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
|