窗体隐藏问题?
'************ 代码开始 **********
Global Const SW_HIDE = 0
Global Const SW_SHOWNORMAL = 1
Global Const SW_SHOWMINIMIZED = 2
Global Const SW_SHOWMAXIMIZED = 3
Private Declare Function ShowWindow Lib "user32 " _
(ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Declare Function apiShowWindow Lib "user32 " _
Alias "ShowWindow " (ByVal hwnd As Long, _
ByVal nCmdShow As Long) As Long
Private Sub Form_Load()
ShowWindow Me.Application.hWndAccessApp, 2
End Sub
Function fSetAccessWindow(nCmdShow As Long)
' 使用举例
' 最大化 Access 窗口
' fSetAccessWindow(SW_SHOWMAXIMIZED)
' 最小化 Access 窗口
' fSetAccessWindow(SW_SHOWMINIMIZED)
' 隐藏 Access 窗口
' fSetAccessWindow(SW_HIDE)
' 正常显示 Access 窗口
' fSetAccessWindow(SW_SHOWNORMAL)
'
Dim loX As Long
Dim loFORM As Form
On Error Resume Next
Set loFORM = Screen.ActiveForm
If Err <> 0 Then ' 没有活动窗体 no ActiveFORM
If nCmdShow = SW_HIDE Then
MsgBox "除非屏幕上有一个窗口,否则不能隐藏 Access 主窗口! " _
& vbCr & vbCr _
& "Cannot hide Access unless " _
& "a FORM is on screen "
Else
loX = apiShowWindow(hWndAccessApp, nCmdShow)
Err.Clear
End If
Else
If nCmdShow = SW_SHOWMINIMIZED And loFORM.Modal = True Then
MsgBox "不能由屏幕上的 " & (loFORM.Caption + " ") & "窗体最小化 Access 主窗口! " &nb