|
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 GWL_STYLE = (-16) Private Const WS_MINIMIZEBOX = &H20000 Private Const WS_MAXIMIZEBOX = &H10000 Public Sub SetCaptionButtons(Frm As Form) Dim lRet As Long lRet = GetWindowLong(Frm.hWnd, GWL_STYLE) SetWindowLong Frm.hWnd, GWL_STYLE, lRet Or _ WS_MINIMIZEBOX * (Abs(Frm.MinButton)) Or _ WS_MAXIMIZEBOX * (Abs(Frm.MaxButton)) End Sub 'You must call the subroutine SetCaptionButtons from the 'Form_Load event, passing a reference to your form. This 'should work in VB3 and VB4 16 with the proper 16-bit API 'declarations (see "Remove Min/Max Buttons From MDI Form"). |