注意:是access主窗体,而不是access里面的某一个窗体,当然,隐藏FORM也是可以的。
这是本论坛的一个帖子,具体是谁的我忘了,我改了一下,提供给需要的朋友。
'=======================================
'新建一个模块。
'在建立一个autoexec宏,“操作”为runcode,参数:启动 ()
'最大化和最小化消失了!
'如果再在access文件所在的目录里面放一个同名的bmp文件(如:db1.mdb;db1.bmp),连启动画面也改成自己的,那就更酷了!
'=================================
'让最大化和最小化按钮消失
'=================================
'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
[此贴子已经被作者于2003-9-18 2:07:55编辑过]
|