Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I manipulate the 3 controls on the top left of an application?

Status
Not open for further replies.

MikeBronner

Programmer
May 9, 2001
756
US
I would like to disable the Maximize/Restore Window button.
How can this be done. My goal here is to prevent the user from making the application smaller than full-screen, but not to disallow him from minimizing it to the task bar.

Thanks guys! Take Care,
Mike
 
To disable the maximize buttom set maxbutton to false on the form. To keep the minimize button make sure minbutton is True. Brad,
Hey! email me any time! Bradsvb@yahoo.com
 
Oops, I should have mentioned that I'm dealing with an MDIForm here, and it doesn't list those properties.

Any ideas in that regard?

Mike Take Care,
Mike
 
Errrrr,
Don't know. Brad,
Hey! email me any time! Bradsvb@yahoo.com
 
Any ideas? Please don't tell me that can't be done. ;-> Take Care,
Mike
 
you need to use API in this case:


Private Declare Function GetWindowLong Lib "user32" Alias _
"GetWindowLongA" (ByVal hwnd As Long, _
ByVal nIndex 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 Const WS_MINIMIZEBOX = &H20000
Private Const WS_MAXIMIZEBOX = &H10000
Private Const GWL_STYLE = (-16)


now on MDIForm_Load put his code:

Dim L As Long

L = GetWindowLong(Me.hwnd, GWL_STYLE)
L = L And Not (WS_MAXIMIZEBOX)
'--> disable max button
L = SetWindowLong(Me.hwnd, GWL_STYLE, L)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top