Access开发培训
网站公告
·Access专家课堂QQ群号:151711184    ·Access快速开发平台下载地址及教程    ·欢迎加入Access专家课堂微信群!    ·如何快速搜索本站文章|示例|资料    
您的位置: 首页 > 技术文章 > 生产应用

将access环境背景隐藏,使你的软件更加专业,美观

时 间:2010-03-15 00:00:00
作 者:张万里   ID:10085  城市:天津
摘 要:将ACCESS环境背景隐藏,使你的软件更加专业,美观,最近发现这个代码大家对此很感兴趣,特加追加实例一个,谢谢关注!
正 文:

点击下载此附件


代   码:

'************ 代码开始 **********
Global Const SW_HIDE = 0
Global Const SW_SHOWNORMAL = 1
Global Const SW_SHOWMINIMIZED = 2
Global Const SW_SHOWMAXIMIZED = 3


Private Declare Function apiShowWindow Lib "user32" _
    Alias "ShowWindow" (ByVal hwnd As Long, _
    ByVal nCmdShow As Long) As Long

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 主窗口!" _
                & vbCr & vbCr _
                & "Cannot minimize Access with " _
                & (loFORM.Caption + " ") _
                & "FORM on screen"
        ElseIf nCmdShow = SW_HIDE And loFORM.PopUp <> True Then
            MsgBox "不能由屏幕上的 " & (loFORM.Caption + " ") & "窗体隐藏 Access 主窗口!" _
                & vbCr & vbCr _
                & "Cannot hide Access with " _
                & (loFORM.Caption + " ") _
                & "FORM on screen"
        Else
            loX = apiShowWindow(hWndAccessApp, nCmdShow)
        End If
    End If
    fSetAccessWindow = (loX <> 0)
End Function

'************ 代码结束 **********
--------------------------------------------------------------------

Private Declare Function ShowWindow Lib "user32" _
  (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long


Private Sub Form_Load()
    ShowWindow Me.Application.hWndAccessApp, 2
End Sub



Access软件网QQ交流群 (群号:54525238)       Access源码网店

常见问答:

技术分类:

相关资源:

专栏作家

关于我们 | 服务条款 | 在线投稿 | 友情链接 | 网站统计 | 网站帮助