Cacher application access lors de l'exec d'une bd

cs_cedric68 Messages postés 2 Date d'inscription lundi 19 août 2002 Statut Membre Dernière intervention 22 août 2002 - 22 août 2002 à 10:49
cs_luxey Messages postés 1 Date d'inscription dimanche 29 décembre 2002 Statut Membre Dernière intervention 28 mai 2005 - 28 mai 2005 à 13:35
je souhaite lors de l'execution de mon appli access cacher access et voir en plein ecran mes differents formulaires .
Quelqu'un a une idee
merci

cedric
:question)

3 réponses

cs_iubito Messages postés 629 Date d'inscription mercredi 3 juillet 2002 Statut Membre Dernière intervention 9 octobre 2006
22 août 2002 à 16:03
Salut Cedric
il doit y avoir une option je ne sais plus où pour faire démarrer automatiquement un formulaire.
Donc tu peux faire démarrer automatiquement ton formulaire principal sans que l'utilisateur aie à double-clicker dessus... Par contre je ne sais plus où c'est (propriété de formulaire, options...)
0
ClickPouf Messages postés 1 Date d'inscription jeudi 27 novembre 2003 Statut Membre Dernière intervention 28 novembre 2003
28 nov. 2003 à 00:11
Salut gars !

J'ai trouvé une soluce à ton problème par hasard... C'est une bidouille, c'est pas beau, ça utilise certainement une erreur de chez microsoft... mais ça marche !

Tout d'abord déclarer les API suivantes dans un module.
'********************************************************************************************
'* ApiWindows               : Déclaration des API Windows                                   *
'********************************************************************************************
Option Compare Database
Option Explicit

' GetDesktopWindow : Donne le pointeur de la fenêtre du bureau
Public Declare Function GetDesktopWindow Lib "user32" ( _
    ) As Long

' GetParent : Donne le pointeur de la fenêtre parent
Public Declare Function GetParent Lib "user32" _
    (ByVal hwnd As Long _
    ) As Long

' GetWindow : Donne le pointeur d'une fenêtre
Public Declare Function GetWindow Lib "user32" _
    (ByVal hwnd As Long _
    , ByVal wCmd As Long _
    ) As Long
Public Const GW_HWNDFIRST = 0                       ' Pointeur de la première fenêtre
Public Const GW_HWNDNext = 2                        ' Pointeur de la fenêtre suivante

' GetWindowRect : Donne le rectangle d'affichage de la fenêtre
Public Declare Function GetWindowRect Lib "user32" _
    (ByVal hwnd As Long _
    , lpRect As RECT _
    ) As Long
Public Type RECT                                    ' Rectangle d'affichage de la fenêtre
    left                    As Long
    top                     As Long
    right                   As Long
    bottom                  As Long
End Type

' MoveWindow : Positionne et dimensionne la fenêtre
Public Declare Function MoveWindow Lib "user32" _
    (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

' ShowWindow : Défini le mode d'affichage de la fenêtre
Public Declare Function ShowWindow Lib "user32" _
    (ByVal hwnd As Long _
    , ByVal nCmdShow As Long _
    ) As Long


Ensuite définir ces deux fonctions

'********************************************************************************************
'* CommonFunctions          : Fonctions communes du projet                                  *
'********************************************************************************************
Option Compare Database
Option Explicit
'HideApplicationForm : Cacher la fenêtre application
Function HideApplicationForm(FormId As Form)
On Error GoTo Err_HideApplicationForm
Dim hwndApplication         As Long                 ' Fenêtre de l'application
Dim lRect                   As RECT                 ' Dimension du bureau
Dim wWidth                  As Long                 ' Largeur du formulaire
Dim wHeight                 As Long                 ' Hauteur du formulaire

' Stocker le pointeur de le fenêtre principale
'---------------------------------------------
Application.Echo False
hwndApplication = GetParent(GetParent(GetWindow(FormId.hwnd, GW_HWNDFIRST)))

' Maximiser la fenêtre principale
'--------------------------------
ShowWindow hwndApplication, 3

' Stocker les dimensions du formulaire
'-------------------------------------
wWidth = FormId.WindowWidth
wHeight = FormId.WindowHeight

' Cacher puis restorer la fenêtre principale
'-------------------------------------------
ShowWindow hwndApplication, 0
ShowWindow hwndApplication, 1

' Stocker les dimensions du bureau
'---------------------------------
GetWindowRect GetDesktopWindow, lRect

' Dimensionner et centrer la fenêtre principale
'----------------------------------------------
If CurrentDb.Properties("StartUpShowStatusBar") = False Then
    MoveWindow hwndApplication _
        , (lRect.right - (wWidth / 15)) / 2 _
        , (lRect.bottom - (wHeight / 15)) / 2 _
        , wWidth / 15, wHeight / 15 _
        , 1
Else
    MoveWindow hwndApplication _
        , (lRect.right - (wWidth / 15)) / 2 _
        , (lRect.bottom - (wHeight / 15)) / 2 _
        , (wWidth / 15), 20 + (wHeight / 15) _
        , 1
End If

' Maximiser le formulaire
'------------------------
DoCmd.Maximize

' Sortie et Gestion des Erreurs
'------------------------------
Exit_HideApplicationForm:
    Application.Echo True
    Exit Function
Err_HideApplicationForm:
    Select Case Err.Number
        Case Else
            MsgBox Err.Number & " " & "CommonFunctions" & " " _
                                    & "HideApplicationForm" & " :" & vbLf _
                                    & Nz(Err.Description, "") & vbLf _
                                    & "Values : " & FormId.Name
    End Select
    Resume Exit_HideApplicationForm
End Function
'ShowApplicationForm : Cacher la fenêtre application
Function ShowApplicationForm(FormId As Form)
On Error GoTo Err_ShowApplicationForm
Dim hwndApplication         As Long                 ' Fenêtre de l'application

' Stocker le pointeur de le fenêtre principale
'---------------------------------------------
Application.Echo False
hwndApplication = GetParent(GetParent(GetWindow(FormId.hwnd, GW_HWNDFIRST)))

' Cacher, afficher puis maximiser la fenêtre principale
'------------------------------------------------------
ShowWindow hwndApplication, 0
ShowWindow hwndApplication, 1
ShowWindow hwndApplication, 3

' Sortie et Gestion des Erreurs
'------------------------------
Exit_ShowApplicationForm:
    Application.Echo True
    Exit Function
Err_ShowApplicationForm:
    Select Case Err.Number
        Case Else
            MsgBox Err.Number & " " & "CommonFunctions" & " " _
                                    & "ShowApplicationForm" & " :" & vbLf _
                                    & Nz(Err.Description, "") & vbLf _
                                    & "Values : " & FormId.Name
    End Select
    Resume Exit_ShowApplicationForm
End Function


Pour cacher la fenêtre principale, appelle la fonction HideApplicationForm à partir de ton formulaire d'ouverture (dans Open_Form par ex).
Attention ! N'oublie pas de créer un bouton, un évènement ou un code touche qui appelle la fonction ShowApplicationForm... Parce que là t'auras plus accès à ta base !!! Tu pourras toujours l'importer dans une autre au cas où.

A+
0
cs_luxey Messages postés 1 Date d'inscription dimanche 29 décembre 2002 Statut Membre Dernière intervention 28 mai 2005
28 mai 2005 à 13:35
tu peu simplement utiliser les obtions de démarages et metre les form en max et independante
0
Rejoignez-nous