08. november 2003 - 04:36
#1
'---------------------------------- MIDForm1 ----------------------------------
Option Explicit
Private Const GWL_STYLE As Long = (-16)
Private Const WS_MAXIMIZEBOX As Long = &H10000
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 Declare Function GetParent Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function SetParent Lib "user32" ( _
ByVal hWndChild As Long, _
ByVal hWndNewParent 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 SetParent(hWnd, GetParent(hWnd))
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)
End Sub
'---------------------------------- MIDForm1 ----------------------------------
08. november 2003 - 21:34
#2
du behøver ikke disse linjer:
'Private Declare Function GetParent Lib "user32" (ByVal hWnd As Long) As Long
'Private Declare Function SetParent Lib "user32" ( _
ByVal hWndChild As Long, _
ByVal hWndNewParent As Long) As Long
'Call SetParent(hWnd, GetParent(hWnd))