|
从网上搜索到的资料,未作测试,如果可行的话请说一声
让access系统窗口的关闭按键失效
首先在通用中声明: Private Declare Function GetSystemMenu Lib "User32" (ByVal hwnd As Long, ByVal bRevert 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 Sub Form_Load() Const MF_BYCOMMAND = &H0& Const SC_CLOSE = &HF060 Dim hMenu As Long hMenu = GetSystemMenu(Application.hWndAccessApp, 0) Call DeleteMenu(hMenu, SC_CLOSE, MF_BYCOMMAND) End Sub
让access系统窗口的最大化、最小化消失的代码?
'新建一个模块。
'在建立一个autoexec宏,“操作”为runcode,参数:启动 ()
'最大化和最小化消失了!
'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)
'===============================
'获得活动窗口的句柄
'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 当前程序的.hwnd
Call 最大化和最小化按钮消失
MoveWindow Application.hWndAccessApp, 20, 20, 600, 400, 1
End Function
|
|