|
Const SW_HIDE = 0
Const SW_SHOWNORMAL = 1
Const SW_SHOWMINIMIZED = 2
Const SW_SHOWMAXIMIZED = 3
Private Declare Function apiShowWindow Lib "user32" Alias "ShowWindow" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
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 SetLayeredWindowAttributes Lib "user32" (ByVal hWnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwflags As Long) As Long
Private Const WS_EX_LAYERED = &H80000
Private Const GWL_EXSTYLE = (-20)
Private Const LWA_ALPHA = &H2
Private Const LWA_COLORKEY = &H1
Sub setMidTransparency(myFrm As Form)
Dim rtn As Long
rtn = GetWindowLong(myFrm.hWnd, GWL_EXSTYLE)
rtn = rtn Or WS_EX_LAYERED
SetWindowLong myFrm.hWnd, GWL_EXSTYLE, rtn
SetLayeredWindowAttributes myFrm.hWnd, 0, 200, LWA_COLORKEY
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
loX = apiShowWindow(hWndAccessApp, nCmdShow)
Err.Clear
fSetAccessWindow = (loX <> 0)
End Function
|
|