Saya bantu nyari, ketemu di sini:
http://bytes.com/topic/access/answers/546461-disable-access-application-maximizebox
pakenya di report:
Private Sub Report_Open(Cancel As Integer)
Call fActivateControlBox(False, Me.Name)
End Sub
berikut module lengkapnya:
Option Compare Database
Option Explicit
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 GetSystemMenu _
Lib "User32" _
(ByVal hWnd As Long, _
ByVal bRevert As Long) As Long
Private Declare Function DrawMenuBar _
Lib "User32" _
(ByVal hWnd As Long) As Long
Private Declare Function DeleteMenu _
Lib "User32" _
(ByVal hMenu As Long, _
ByVal nPosition As Long, _
ByVal wFlags As Long) As Long
Private Const MF_BYCOMMAND = &H0&
Private Const SC_CLOSE = &HF060
Private Const WS_SYSMENU = &H80000
Private Const WS_MAXIMIZEBOX = &H10000
Private Const WS_MINIMIZEBOX = &H20000
Private Const GWL_STYLE = (-16)
Public Function fActivateControlBox(Enable As Boolean, strName As String)
Dim CurStyle As Long
Dim hWnd As Long
' hWnd = Access.hWndAccessApp
hWnd = Reports(strName).hWnd
CurStyle = GetWindowLong(hWnd, GWL_STYLE)
If Enable Then
If Not (CurStyle And WS_SYSMENU) Then
CurStyle = CurStyle Or WS_SYSMENU
End If
Else
If (CurStyle And WS_SYSMENU) = WS_SYSMENU Then
CurStyle = CurStyle - WS_SYSMENU
End If
End If
Call SetWindowLong(hWnd, GWL_STYLE, CurStyle)
Call DrawMenuBar(hWnd)
End Function
Public Function fActivateCloseBox(Enable As Boolean, strName As String)
Dim hMenu As Long
Dim hWnd As Long
' hWnd = Access.hWndAccessApp
hWnd = Reports(strName).hWnd
If Enable Then
Call GetSystemMenu(hWnd, True)
Else
hMenu = GetSystemMenu(hWnd, False)
If hMenu Then
Call DeleteMenu(hMenu, SC_CLOSE, MF_BYCOMMAND)
End If
End If
Call DrawMenuBar(hWnd)
End Function
Public Function fActivateMaximizeBox(Enable As Boolean, strName As String)
Dim CurStyle As Long
Dim hWnd As Long
' hWnd = Access.hWndAccessApp
hWnd = Reports(strName).hWnd
CurStyle = GetWindowLong(hWnd, GWL_STYLE)
If Enable Then
If Not (CurStyle And WS_MAXIMIZEBOX) Then
CurStyle = CurStyle Or WS_MAXIMIZEBOX
End If
Else
If (CurStyle And WS_MAXIMIZEBOX) = WS_MAXIMIZEBOX Then
CurStyle = CurStyle - WS_MAXIMIZEBOX
End If
End If
Call SetWindowLong(hWnd, GWL_STYLE, CurStyle)
Call DrawMenuBar(hWnd)
End Function
Public Function fActivateMinimizeBox(Enable As Boolean, strName As String)
Dim CurStyle As Long
Dim hWnd As Long
'hWnd = Access.hWndAccessApp
hWnd = Reports(strName).hWnd
CurStyle = GetWindowLong(hWnd, GWL_STYLE)
If Enable Then
If Not (CurStyle And WS_MINIMIZEBOX) Then
CurStyle = CurStyle Or WS_MINIMIZEBOX
End If
Else
If (CurStyle And WS_MINIMIZEBOX) = WS_MINIMIZEBOX Then
CurStyle = CurStyle - WS_MINIMIZEBOX
End If
End If
Call SetWindowLong(hWnd, GWL_STYLE, CurStyle)
Call DrawMenuBar(hWnd)
End Function
aksan kurdin
--- In [email protected], "PEACE" <boypeace...@...> wrote:
>
>
>
> --- In [email protected], BoyPeace pamotan <boypeace.81@> wrote:
> >
> > Bagaimana cara mendisable restore atau minimize button pada report,
> > karena kalau di disable dari properties max dan min, record page
> > number tidak nampak?
> > udah searching di google belum ketemu
> >
>
> -----------------------------------------------
> saya searching cuma module ini yang ketemu tapi masih debug..
>
>
>
> Public Function fActivateReportMaximizeBox(Enable As Boolean, strName As
> String)
> Dim CurStyle As Long
> Dim hWnd As Long
>
> hWnd = Reports(strName).hWnd '<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>
> CurStyle = GetWindowLong(hWnd, GWL_STYLE)
> If Enable Then
> If Not (CurStyle And WS_MAXIMIZEBOX) Then
> CurStyle = CurStyle Or WS_MAXIMIZEBOX
> End If
> Else
> If (CurStyle And WS_MAXIMIZEBOX) = WS_MAXIMIZEBOX Then
> CurStyle = CurStyle - WS_MAXIMIZEBOX
> End If
> End If
> Call SetWindowLong(hWnd, GWL_STYLE, CurStyle)
> Call DrawMenuBar(hWnd)
>
> End Function
>
> Add this line to the OnOpen event of the report(s) you want to
>
> Call fActivateReportMaximizeBox(False, Me.Name)
>
> You can make the same basic change to anyone of the fumctions contained in
> the module.
> If you want to also manipulate the buttons on forms, change -
>
> hWnd = Reports(strName).hWnd
> to
> hWnd = Forms(strName).hWnd
>