显示没有默认访问框架的访问 GUI [英] Displaying an Access GUI without the default Access frame
问题描述
有没有办法告诉访问只显示表单/报告而不显示访问窗口本身(访问表单填充在其中的外壳"窗口).
Is there a way to tell access to only display the forms/reports without displaying the access window itself (the "shell" window that the access forms populate inside of).
推荐答案
为此,我利用了一段由一些聪明人编写并在网上可用的代码(我认为它最初是由 Terry Kreft 编写的?) 并参考一些 Windows API.
To do so, I take advantage of a piece of code written by some clever guys and available on the net (I think it was originally written by Terry Kreft?) and referring to some windows API.
我先有这个:
Declare Function apiShowWindow Lib "user32" _
Alias "ShowWindow" (ByVal hwnd As Long, _
ByVal nCmdShow As Long) As Long
Global Const SW_HIDE = 0
Global Const SW_SHOWNORMAL = 1
Global Const SW_SHOWMINIMIZED = 2
Global Const SW_SHOWMAXIMIZED = 3
还有那个
Function fSetAccessWindow(nCmdShow As Long)
'Usage Examples
'Maximize window:
' ?fSetAccessWindow(SW_SHOWMAXIMIZED)
'Minimize window:
' ?fSetAccessWindow(SW_SHOWMINIMIZED)
'Hide window:
' ?fSetAccessWindow(SW_HIDE)
'Normal window:
' ?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 "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 "Cannot minimize Access with this form on screen:" & (loForm.Caption + " ")
Else
If nCmdShow = SW_HIDE And loForm.PopUp <> True Then
MsgBox "Cannot hide Access with this form on screen:" & (loForm.Caption + " ")
Else
loX = apiShowWindow(hWndAccessApp, nCmdShow)
End If
End If
End If
fSetAccessWindow = (loX <> 0)
End Function
启动我的程序时,我会这样调用函数
When starting my program, I will then call the function this way
'function is called by autoexec Macro'
...
fSetAccessWindow (SW_HIDE)
...
DoCmd.OpenForm my_Startup_Form
Forms(my_Startup_Form).Controls(my_Active_Control).SetFocus
屏幕会闪烁"一点,主窗口会短暂出现,然后消失.我的焦点窗口将单独显示.
The screen will 'flicker' a little bit, and the main window will appear briefly, then disappear. My focussed window will then be displayed alone.
这篇关于显示没有默认访问框架的访问 GUI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!