26. januar 2004 - 12:28
#2
'---------------------------------- MIDForm1 ----------------------------------
Option Explicit
Private Const GWL_STYLE As Long = (-16)
Private Const WS_MAXIMIZEBOX As Long = &H10000
Private Const WS_MINIMIZEBOX As Long = &H20000
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 HWND_NOTOPMOST As Long = (-2)
Private Const SWP_NOZORDER As Long = &H4
Private Const SWP_NOSIZE As Long = &H1
Private Const SWP_NOMOVE As Long = &H2
Private Const SWP_FRAMECHANGED As Long = &H20
Private Declare Function SetWindowPos Lib "user32" ( _
ByVal hWnd As Long, _
ByVal hWndInsertAfter As Long, _
ByVal x As Long, _
ByVal y As Long, _
ByVal cx As Long, _
ByVal cy As Long, _
ByVal wFlags As Long) As Long
Public Sub DisableMax(ByVal hWnd As Long)
Dim lStyle As Long
lStyle = GetWindowLong(hWnd, GWL_STYLE)
lStyle = (lStyle And Not WS_MAXIMIZEBOX)
Call SetWindowLong(hWnd, GWL_STYLE, lStyle)
Call SetWindowPos(hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, _
SWP_NOZORDER Or SWP_NOSIZE Or _
SWP_NOMOVE Or SWP_FRAMECHANGED)
End Sub
Public Sub DisableMin(ByVal hWnd As Long)
Dim lStyle As Long
lStyle = GetWindowLong(hWnd, GWL_STYLE)
lStyle = (lStyle And Not WS_MINIMIZEBOX)
Call SetWindowLong(hWnd, GWL_STYLE, lStyle)
Call SetWindowPos(hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, _
SWP_NOZORDER Or SWP_NOSIZE Or _
SWP_NOMOVE Or SWP_FRAMECHANGED)
End Sub
Private Sub MDIForm_Load()
Call DisableMax(Me.hWnd)
Call DisableMin(Me.hWnd)
End Sub
'---------------------------------- MIDForm1 ----------------------------------