作 者:竹笛
摘 要:讓access系統(tǒng)窗口的最大化、最小化消失的代碼
正 文:
'新建一個(gè)模塊。
'在建立一個(gè)autoexec宏,“操作”為runcode,參數(shù):?jiǎn)?dòng) ()
'最大化和最小化消失了,!
'api聲明:
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 GetWindowLong Lib "user32" _
Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal _
nIndex As Long) As Long
Const WS_MINIMIZEBOX = &H20000
Const WS_MAXIMIZEBOX = &H10000
Const GWL_STYLE = (-16)
'===============================
'獲得活動(dòng)窗口的句柄
'Declare Function GetActiveWindow Lib "user32" () As Long
'===================
'改變窗體大小
Declare Function MoveWindow Lib "user32" (ByVal hwnd As Long, ByVal X As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Long) As Long
'使用:
Sub 最大化和最小化按鈕消失()
Dim lWnd As Long
lWnd = GetWindowLong(Application.hWndAccessApp, GWL_STYLE)
lWnd = lWnd And Not (WS_MINIMIZEBOX)'最小化
lWnd = lWnd And Not (WS_MAXIMIZEBOX)‘最大化
lWnd = SetWindowLong(Application.hWndAccessApp, GWL_STYLE, lWnd)
End Sub
Public Function 改變窗體大小()
'Application.hWndAccessApp 當(dāng)前程序的.hwnd
Call 最大化和最小化按鈕消失
MoveWindow Application.hWndAccessApp, 20, 20, 600, 400, 1
End Function