Hallo,
ich hatte mal im Netz eine sehr nützliche Funktion gefunden, mit der ich die Access-Fenstergröße einstellen und das Verändern der Größe des Fensters verhindern kann.
Die Funktion(en) funktionieren genau nach meiner Vorstellung, jedoch mit der Einschränkung, dass sich Access immer in den Vordergrund drängelt.
Sobald man ein anderes Windows-Programm öffnet, wird das gerade geöffnete Programm in den Hintergrund und im Anschluss sofort wieder das Access-Fenster in den Vordergrund gesetzt. Gleiches trifft zu, wenn sich Windows-Hintergrundprozesse öffnen.
Daher die Frage, ob man das verhindern kann?
Dank vorab
Gruß
Ronny
Public Declare Function IsIconic Lib „user32“ (ByVal hwnd As Long) As Long 'Minimieren verhindern
'Folgenden Code im entsprechenden Formular einfügen:
'Private Sub Form_Resize()
'If IsIconic(Me.hwnd) = 1 Then
’ DoCmd.RunCommand acCmdAppMinimize
'Else
’ DoCmd.RunCommand acCmdAppRestore
'End If
'End Sub
'Acces-Fenstergröße
Declare Function apiGetActiveWindow Lib „user32“ Alias „GetActiveWindow“ () As Long
Declare Function apiGetParent Lib „user32“ Alias „GetParent“ (ByVal hwnd As Long) As Long
Declare Function apiMoveWindow Lib „user32“ Alias „MoveWindow“ _
(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
Function GetAccesshWnd()
Dim hwnd As Long
Dim hWndAccess As Long
’ Get the handle to the currently active window.
hwnd = apiGetActiveWindow()
hWndAccess = hwnd
’ Find the top window (which has no parent window).
While hwnd 0
hWndAccess = hwnd
hwnd = apiGetParent(hwnd)
Wend
GetAccesshWnd = hWndAccess
End Function
Function AccessMoveSize(iX As Integer, iY As Integer, iWidth As _
Integer, iHeight As Integer)
apiMoveWindow GetAccesshWnd(), iX, iY, iWidth, iHeight, True
End Function
Function autoexec()
Dim a
a = AccessMoveSize(0, 0, 1024, 750)
…
End Function