IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

DirectX Discussion :

Comment maintenir le plein écran quand une autre fenetre s'ouvre ?


Sujet :

DirectX

  1. #1
    Membre très actif
    Profil pro
    Inscrit en
    Octobre 2003
    Messages
    434
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2003
    Messages : 434
    Par défaut Comment maintenir le plein écran quand une autre fenetre s'ouvre ?
    Bonjour, j'aimerai savoir s'il est possible de maintenir son jeu en plein écran quan la fenetre d'une application s'ouvre ?
    Merci

  2. #2
    Membre extrêmement actif

    Homme Profil pro
    Ingénieur R&D
    Inscrit en
    Juin 2003
    Messages
    4 506
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 44
    Localisation : France, Essonne (Île de France)

    Informations professionnelles :
    Activité : Ingénieur R&D
    Secteur : Industrie

    Informations forums :
    Inscription : Juin 2003
    Messages : 4 506
    Par défaut
    cela dépend de la bibliothèque de fenêtrage que tu utilises. Avec l'API windows tu as un flag MOST_TOP il me semble quelque chose comme ça

  3. #3
    Membre Expert

    Homme Profil pro
    Développeur informatique
    Inscrit en
    Septembre 2007
    Messages
    1 895
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 49
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Opérateur de télécommunications

    Informations forums :
    Inscription : Septembre 2007
    Messages : 1 895
    Par défaut
    Citation Envoyé par hegros Voir le message
    cela dépend de la bibliothèque de fenêtrage que tu utilises. Avec l'API windows tu as un flag MOST_TOP il me semble quelque chose comme ça
    Mettre un flag particulier ne change rien. Un jeu en plein écran n'est pas exécuté dans le contexte GDI de Windows, qui est nécessaire à l'affichage d'une fenêtre. De fait, si une fenêtre en provenance d'une autre application est affichée, on change de contexte et on quitte le mode plein écran.

    Il est possible de modifier ce comportement dans le cas ou c'est le jeu qui affiche la fenêtre Windows (puisque le jeu peut transférer le contrôle du dessin du GDI vers la carte graphique (bon, ok, c'est un peu plus compliqué que ça...)). Mais hors de ce cas, ce que tu (supergrey) souhaites est impossible - à ma connaissance.
    [FAQ des forums][FAQ Développement 2D, 3D et Jeux][Si vous ne savez pas ou vous en êtes...]
    Essayez d'écrire clairement (c'est à dire avec des mots français complets). SMS est votre ennemi.
    Evitez les arguments inutiles - DirectMachin vs. OpenTruc ou G++ vs. Café. C'est dépassé tout ça.
    Et si vous êtes sages, vous aurez peut être vous aussi la chance de passer à la télé. Ou pas.

    Ce site contient un forum d'entraide gratuit. Il ne s'use que si l'on ne s'en sert pas.

  4. #4
    Membre très actif
    Profil pro
    Inscrit en
    Octobre 2003
    Messages
    434
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2003
    Messages : 434
    Par défaut
    ok... ça doit quand même être possible avec un hook... mais les antivirus n'aime pas les hooks...
    Merci pour vos réponses.

  5. #5
    Expert confirmé
    Avatar de Mat.M
    Profil pro
    Développeur informatique
    Inscrit en
    Novembre 2006
    Messages
    8 525
    Détails du profil
    Informations personnelles :
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Novembre 2006
    Messages : 8 525
    Par défaut
    Citation Envoyé par supergrey Voir le message
    Bonjour, j'aimerai savoir s'il est possible de maintenir son jeu en plein écran quan la fenetre d'une application s'ouvre ?
    Merci
    Quelles techs , quels biblios , quel compilateur ?
    On n'est pas madame Soleil..
    Regarder dans les FAQ du SDK de Direct X 9.0c il ya une astuce donnée par Microsoft pour garder le plein écran et notamment éviter ALT-TAB

  6. #6
    Membre très actif
    Profil pro
    Inscrit en
    Octobre 2003
    Messages
    434
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2003
    Messages : 434
    Par défaut
    On n'est pas madame Soleil..
    Heureusement pour toi.
    C'est pour windows et mon jeu tourne avec directx.

  7. #7
    Membre très actif
    Profil pro
    Inscrit en
    Octobre 2003
    Messages
    434
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2003
    Messages : 434
    Par défaut
    Si on pouvait connaitre l'astuce, parceque je ne trouve pas dans la doc de directx...

  8. #8
    Membre très actif
    Profil pro
    Inscrit en
    Octobre 2003
    Messages
    434
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2003
    Messages : 434
    Par défaut
    Pas d'âme charitable ?

  9. #9
    Expert confirmé
    Avatar de Mat.M
    Profil pro
    Développeur informatique
    Inscrit en
    Novembre 2006
    Messages
    8 525
    Détails du profil
    Informations personnelles :
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Novembre 2006
    Messages : 8 525
    Par défaut
    Citation Envoyé par supergrey Voir le message
    Heureusement pour toi.
    C'est pour windows et mon jeu tourne avec directx.
    Oui mais Direct X c'est x composantes.
    Avec Direct3d ?

    Disabling Shortcut Keys in Games
    By Jason Sandlin, Software Development Lead

    XNA Developer Connection (XDC)

    December 2004

    This document describes how to temporarily disable keyboard shortcuts in Microsoft® Windows® to prevent disruption of game play for full screen games. The SHIFT key and the CTRL key are often used as fire or run buttons in games. Accidentally pressing the Windows key (located near these keys) can cause the user to suddenly jump out of the application, ruining the game experience. Simply using the SHIFT key as a game button can inadvertently execute the StickyKeys shortcut which may display a warning dialog. To avoid these issues, you should disable these keys when running in full-screen mode, and either enable the keys back to their default handlers when running in windowed mode or exit the application.

    This article describes how to do the following:

    Disable the Windows Key with a Keyboard Hook
    Disable the Accessibility Shortcut Keys
    Disable the Windows Key with a Keyboard Hook
    Use a low-level keyboard hook to filter out the Windows key from being processed. The low-level keyboard hook shown in Example 1 remains in effect even if a user minimizes the window or switches to another application. This means that you must be careful to ensure that the Windows key is not disabled when the application is deactivated. The code in Example 1 does this by handling the WM_ACTIVATEAPP message.

    Note This method works on Windows 2000 and later versions of Windows. This method also works with least-privileged user accounts (also known as limited-user accounts).

    This method is used by DXUT and is illustrated in the following code example.

    Example 1. Using a low-level keyboard hook to disable the Windows key

    HHOOK g_hKeyboardHook;
    BOOL g_bFullscreen;

    INT WINAPI WinMain( HINSTANCE, HINSTANCE, LPSTR, int )
    {
    // Initialization
    g_hKeyboardHook = SetWindowsHookEx( WH_KEYBOARD_LL, LowLevelKeyboardProc, GetModuleHandle(NULL), 0 );

    //
    // main application code here
    //

    // Cleanup before shutdown
    UnhookWindowsHookEx( g_hKeyboardHook );
    }


    LRESULT CALLBACK LowLevelKeyboardProc( int nCode, WPARAM wParam, LPARAM lParam )
    {
    if (nCode < 0 || nCode != HC_ACTION ) // do not process message
    return CallNextHookEx( g_hKeyboardHook, nCode, wParam, lParam);

    bool bEatKeystroke = false;
    KBDLLHOOKSTRUCT* p = (KBDLLHOOKSTRUCT*)lParam;
    switch (wParam)
    {
    case WM_KEYDOWN:
    case WM_KEYUP:
    {
    bEatKeystroke = (g_bFullscreen && g_bWindowActive && ((p->vkCode == VK_LWIN) || (p->vkCode == VK_RWIN)));
    break;
    }
    }

    if( bEatKeystroke )
    return 1;
    else
    return CallNextHookEx( g_hKeyboardHook, nCode, wParam, lParam );
    }


    LRESULT CALLBACK WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
    {
    switch( uMsg )
    {
    case WM_ACTIVATEAPP:
    // g_bWindowActive is used to control if the Windows key is filtered by the keyboard hook or not.
    if( wParam == TRUE )
    g_bWindowActive = true;
    else
    g_bWindowActive = false;
    break;
    }
    }

    Disable the Accessibility Shortcut Keys
    Windows includes accessibility features such as StickyKeys, FilterKeys, and ToggleKeys (see Windows Accessability). Each of these serves a different purpose; StickyKeys for example, is designed for people who have difficulty holding down two or more keys simultaneously. Each of these accessibility features also has a keyboard shortcut that allows the feature to be turned on or off. For example, the StickyKeys shortcut is triggered by pressing the SHIFT key five times. If the SHIFT key is also used in the game, the user could accidentally trigger this shortcut during game play. When the shortcut is triggered, Windows (by default) presents a warning in a dialog box, which would cause Windows to minimize a game running in full-screen mode. This, of course, can have a drastic effect on game play.

    The accessibility features are required for some customers and do not themselves interfere with full-screen games; therefore, you should not change the accessibility settings. However, because the shortcuts for accessibility features can disrupt game play if triggered accidentally, you should turn off an accessibility shortcut only when that feature is not enabled by calling SystemParametersInfo.

    An accessibility shortcut that is turned off by SystemParametersInfo remains turned off even after the application has exited. This means that you must restore the settings before exiting the application. Because it is possible for the application to fail to exit correctly, you should write these settings to persistent storage so that they can be restored when the application is run again. You could also use an exception handler to restore these settings if a crash occurs.

    To turn off these shortcuts, you need to:

    Capture the current accessibility settings before disabling them.
    Disable the accessibility shortcut when the application goes into full-screen mode if the accessibility feature is off.
    Restore the accessibility settings when the application goes into windowed mode or exits.
    This method is used in DXUT, and is illustrated in the following code example.

    Note This method works when running on a limited user account.

    Example 2. Disabling accessibility shortcut keys

    STICKYKEYS g_StartupStickyKeys = {sizeof(STICKYKEYS), 0};
    TOGGLEKEYS g_StartupToggleKeys = {sizeof(TOGGLEKEYS), 0};
    FILTERKEYS g_StartupFilterKeys = {sizeof(FILTERKEYS), 0};


    INT WINAPI WinMain( HINSTANCE, HINSTANCE, LPSTR, int )
    {
    // Save the current sticky/toggle/filter key settings so they can be restored them later
    SystemParametersInfo(SPI_GETSTICKYKEYS, sizeof(STICKYKEYS), &g_StartupStickyKeys, 0);
    SystemParametersInfo(SPI_GETTOGGLEKEYS, sizeof(TOGGLEKEYS), &g_StartupToggleKeys, 0);
    SystemParametersInfo(SPI_GETFILTERKEYS, sizeof(FILTERKEYS), &g_StartupFilterKeys, 0);

    // Disable when full screen
    AllowAccessibilityShortcutKeys( true );

    // Restore back when going to windowed or shutting down
    AllowAccessibilityShortcutKeys( false );
    }


    void AllowAccessibilityShortcutKeys( bool bAllowKeys )
    {
    if( bAllowKeys )
    {
    // Restore StickyKeys/etc to original state and enable Windows key
    STICKYKEYS sk = g_StartupStickyKeys;
    TOGGLEKEYS tk = g_StartupToggleKeys;
    FILTERKEYS fk = g_StartupFilterKeys;

    SystemParametersInfo(SPI_SETSTICKYKEYS, sizeof(STICKYKEYS), &g_StartupStickyKeys, 0);
    SystemParametersInfo(SPI_SETTOGGLEKEYS, sizeof(TOGGLEKEYS), &g_StartupToggleKeys, 0);
    SystemParametersInfo(SPI_SETFILTERKEYS, sizeof(FILTERKEYS), &g_StartupFilterKeys, 0);
    }
    else
    {
    // Disable StickyKeys/etc shortcuts but if the accessibility feature is on,
    // then leave the settings alone as its probably being usefully used

    STICKYKEYS skOff = g_StartupStickyKeys;
    if( (skOff.dwFlags & SKF_STICKYKEYSON) == 0 )
    {
    // Disable the hotkey and the confirmation
    skOff.dwFlags &= ~SKF_HOTKEYACTIVE;
    skOff.dwFlags &= ~SKF_CONFIRMHOTKEY;

    SystemParametersInfo(SPI_SETSTICKYKEYS, sizeof(STICKYKEYS), &skOff, 0);
    }

    TOGGLEKEYS tkOff = g_StartupToggleKeys;
    if( (tkOff.dwFlags & TKF_TOGGLEKEYSON) == 0 )
    {
    // Disable the hotkey and the confirmation
    tkOff.dwFlags &= ~TKF_HOTKEYACTIVE;
    tkOff.dwFlags &= ~TKF_CONFIRMHOTKEY;

    SystemParametersInfo(SPI_SETTOGGLEKEYS, sizeof(TOGGLEKEYS), &tkOff, 0);
    }

    FILTERKEYS fkOff = g_StartupFilterKeys;
    if( (fkOff.dwFlags & FKF_FILTERKEYSON) == 0 )
    {
    // Disable the hotkey and the confirmation
    fkOff.dwFlags &= ~FKF_HOTKEYACTIVE;
    fkOff.dwFlags &= ~FKF_CONFIRMHOTKEY;

    SystemParametersInfo(SPI_SETFILTERKEYS, sizeof(FILTERKEYS), &fkOff, 0);
    }
    }
    }

  10. #10
    Membre Expert

    Profil pro
    Programmeur
    Inscrit en
    Août 2002
    Messages
    1 091
    Détails du profil
    Informations personnelles :
    Localisation : Etats-Unis

    Informations professionnelles :
    Activité : Programmeur

    Informations forums :
    Inscription : Août 2002
    Messages : 1 091
    Par défaut
    Citation Envoyé par Mat.M Voir le message
    Quelles techs , quels biblios , quel compilateur ?
    On n'est pas madame Soleil..
    Regarder dans les FAQ du SDK de Direct X 9.0c il ya une astuce donnée par Microsoft pour garder le plein écran et notamment éviter ALT-TAB
    Ah non ! on n'empeche pas alt-tab (jamais), ni ctrl alt del.

    Windows c'est un environnement multitache et les jeux comme les applications doivent collaborer un minimum. Si vous ne voulez pas qu'une autre application prenne la main, ne lancez pas d'autres applications en tache de fond de votre jeu, c'est aussi simple que ça..

    Mon site web | Mon blog | Mes photos | Groupe USA
    > BONJOUR, JE SUIS NOUVEAU SUR CE FORUM
    > presse la touche caps lock, stp
    > OH.. MERCI C EST BEAUCOUP PLUS FACILE COMME CA

  11. #11
    Expert confirmé

    Homme Profil pro
    Ingénieur systèmes et réseaux
    Inscrit en
    Février 2007
    Messages
    4 253
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Ingénieur systèmes et réseaux
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Février 2007
    Messages : 4 253
    Billets dans le blog
    3
    Par défaut
    Franchement, la moindre des choses, c'est de gérer le alt+tab .... et c'est tellement facile puisqu'il faut de toute manière le gérer indirectement quand on "perd" le device (ctrl+alt+supp, ou Windows+tab, ...).

    Le Alt+Enter est un poil plus compliqué... d'accord, mais Alt+Tab c'est vraiment le minimum !

    A noter que tout devient carrément trivial sous DX10.

  12. #12
    Membre très actif
    Profil pro
    Inscrit en
    Octobre 2003
    Messages
    434
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2003
    Messages : 434
    Par défaut
    Ouai bon, moi je m'en fou des touches, le but c'était d'empécher une autre application de faire quitter le plein écran en ouvrant une fenetre, mais a priori ce n'est pas possible a par avec un hook sur l'ouverture de fenetre.

  13. #13
    Membre extrêmement actif

    Homme Profil pro
    Ingénieur R&D
    Inscrit en
    Juin 2003
    Messages
    4 506
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 44
    Localisation : France, Essonne (Île de France)

    Informations professionnelles :
    Activité : Ingénieur R&D
    Secteur : Industrie

    Informations forums :
    Inscription : Juin 2003
    Messages : 4 506
    Par défaut
    Citation Envoyé par Emmanuel Deloget Voir le message
    Mettre un flag particulier ne change rien. Un jeu en plein écran n'est pas exécuté dans le contexte GDI de Windows, qui est nécessaire à l'affichage d'une fenêtre. De fait, si une fenêtre en provenance d'une autre application est affichée, on change de contexte et on quitte le mode plein écran.

    Il est possible de modifier ce comportement dans le cas ou c'est le jeu qui affiche la fenêtre Windows (puisque le jeu peut transférer le contrôle du dessin du GDI vers la carte graphique (bon, ok, c'est un peu plus compliqué que ça...)). Mais hors de ce cas, ce que tu (supergrey) souhaites est impossible - à ma connaissance.
    en effet je lisais fenêtre toujours devant les autres...pour le reste je ne sais pas

  14. #14
    Expert confirmé
    Avatar de Mat.M
    Profil pro
    Développeur informatique
    Inscrit en
    Novembre 2006
    Messages
    8 525
    Détails du profil
    Informations personnelles :
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Novembre 2006
    Messages : 8 525
    Par défaut
    Citation Envoyé par LeGreg Voir le message
    Ah non ! on n'empeche pas alt-tab (jamais), ni ctrl alt del.
    ..
    Faut pas me tirer dessus LeGreg je proposais une piste
    SuperGrey pq veut-tu maintenir le plein écran à ce prix ?

Discussions similaires

  1. insertion d'une nouvelle feuille quand une autre est pleine
    Par rom05 dans le forum Macros et VBA Excel
    Réponses: 2
    Dernier message: 18/04/2008, 08h50
  2. [C#][Débutant] Comment lancer une methode d'une autre fenetre
    Par Cazaux-Moutou-Philippe dans le forum Windows Forms
    Réponses: 5
    Dernier message: 30/04/2006, 23h17
  3. Plein écran dans une page Web
    Par uron86 dans le forum Balisage (X)HTML et validation W3C
    Réponses: 4
    Dernier message: 31/10/2005, 16h44
  4. Ouvrir une popup en plein écran avec une barre de menu.
    Par magic8392 dans le forum Général JavaScript
    Réponses: 21
    Dernier message: 12/10/2005, 10h43
  5. comment faire fonctionner l'exe sur une autre machine
    Par brian79 dans le forum C++Builder
    Réponses: 8
    Dernier message: 28/05/2004, 14h00

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo