How To Disable Maximize Button in MDI Form
Hello There,
Can anyone please tell me how to disable maximize button in MDI Form. I also want to disable form resize function on that MDI Form. I have a little idea that if I use API programming I could do it. But I dont know how to do it. Plz help me...THANKS
Re: How To Disable Maximize Button in MDI Form
Re: How To Disable Maximize Button in MDI Form
Download FormBdr from Karl E.Peterson's site - best sample all arround.
Re: How To Disable Maximize Button in MDI Form
Use Rhino's link.
(Just as I've already written this code for you, I'm posting it here. :p)
Disable MDI Form Resize:
VB Code:
' Inside MDI Form
Option Explicit
'================================================================
Private Sub MDIForm_Load()
' Subclass the form
pOldWindPoc = SetWindowLong(Me.hwnd, GWL_WNDPROC, AddressOf WndProc)
End Sub
'==================================================================
Private Sub MDIForm_Unload(Cancel As Integer)
' Un-subclass the form
SetWindowLong Me.hwnd, GWL_WNDPROC, pOldWindPoc
End Sub
VB Code:
'Inside a Module
Option Explicit
Public Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" _
(ByVal lpPrevWndFunc As Long, _
ByVal hwnd As Long, _
ByVal msg As Long, _
ByVal wParam As Long, _
lParam As WINDOWPOS) As Long
Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
(ByVal hwnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Private Type WINDOWPOS
hwnd As Long
hWndInsertAfter As Long
x As Long
y As Long
cx As Long
cy As Long
flags As Long
End Type
Public pOldWindPoc As Long ' A pointer to the old window procedure
Public Const GWL_WNDPROC& = (-4)
Private Const WM_WINDOWPOSCHANGING As Long = &H46
Private Const SWP_NOSIZE As Long = &H1
'================================================================
' Our new window procedure
Public Function WndProc(ByVal hwnd As Long, _
ByVal uMsg As Long, _
ByVal wParam As Long, _
lParam As WINDOWPOS) As Long
If uMsg = WM_WINDOWPOSCHANGING Then
' Ignore sizing
lParam.flags = lParam.flags Or SWP_NOSIZE
End If
' Pass the message to original WinProc
WndProc = CallWindowProc(pOldWindPoc, hwnd, uMsg, wParam, lParam)
End Function
Re: How To Disable Maximize Button in MDI Form
The code doesn't changes mouse cursor. You may want to use SetCursor API for that.
Re: How To Disable Maximize Button in MDI Form
Hi There can anyone tell me how to disable the minimize button on an mdi parent form, as i've written quite a big application and when a person minimizes the app it disappears, so i thought of stopping them from minimizing at all for now. thank you
Re: How To Disable Maximize Button in MDI Form
Quote:
Originally Posted by
Psycho187
... when a person minimizes the app it disappears, ...
Not sure what it means.
Quote:
Originally Posted by
Psycho187
Hi There can anyone tell me how to disable the minimize button on an mdi parent form...
You can find your answer in post #3.