Overlays unter Windows Vista und höher mit DirectDraw nicht mehr möglich?



  • Hiho Community,
    sorry aber ich bin noch nicht ganz durch mit dem Thema Overlays. Da ich ja Anfangs Probleme hatte mit Direct3D9 Overlays zu erstellen und irgendwie nix funktioniert hatte, habe ich mich dann doch für das explizite Erstellen mit DirectDraw 7 entschieden.

    So nun das eigentliche Problem was sich ergibt auf WinVista und höher, beim Aufruf der ::UpdateOverlay Methode wird der Errorcode [DDERR_OUTOFCAPS] zurück gegeben. Wie hab ich das zu verstehn, das sich das Betriebsystem die komplette Kapazität an Overlays resaviert? Kann ich da irgendwas machen?, etwa erzwingen das Ressourcen freigegeben werden?

    Wäre euch echt dankbar, wenn ihr mir da weiter helfen koennt.

    Lg Tobi.

    P.S.: Wenn das jetzt nicht rüberkam, unter WinXP funktioniert alles fein.



  • So hab die Lösung 🙂
    Das Problem ist der "Windows Desktop Manager", um eigene Overlays in die Primary zu rendern muss zu erst dieses AeroGlass ausgestellt werden und das geht so:

    void DisableDesktopManager( const bool bDisable ) {
    
        // Load "dwmapi.dll"
        HMODULE hDWM = LoadLibrary( "dwmapi.dll" );
    
        if( hDWM != NULL ) {
    
            // define functionpointer
            typedef HRESULT ( __stdcall *fpDwmIsCompositionEnabled )( BOOL *bEnabled );
            typedef HRESULT ( __stdcall *fpDwmEnableComposition )( UINT uCompositionAction );
    
            // Get pointer to functions
            fpDwmIsCompositionEnabled dwmCompEnabled = (fpDwmIsCompositionEnabled)GetProcAddress( hDWM, "DwmIsCompositionEnabled" );
            fpDwmEnableComposition    dwmEnableComp  = (fpDwmEnableComposition)GetProcAddress( hDWM, "DwmEnableComposition" );
    
            // Check if enabled
            HRESULT hRes    = 0;
            BOOL bComp      = false;
    
            hRes = dwmCompEnabled( &bComp );
            if( hRes != S_OK ) {
    
                MessageBox( 0, "Could not determine compositions status.", "Error!", MB_OK | MB_ICONERROR );
            }
            else {
    
                // Disable
                if( ( bComp == true ) && ( bDisable == true ) ) {
    
                    hRes = dwmEnableComp( 0 );
                    if( hRes != S_OK ) {
    
                        MessageBox( 0, "Could not disable composition.", "Error!", MB_OK | MB_ICONERROR );
                    }
    
                    m_bDWM = true;
                }
                // Enable
                else if( ( bComp == false ) && ( bDisable == false ) ) {
    
                    hRes = dwmEnableComp( 1 );
                    if( hRes != S_OK ) {
    
                        MessageBox( 0, "Could not enable composition.", "Error!", MB_OK | MB_ICONERROR );
                    }
    
                    m_bDWM = false;
                }
                // Else do nothing
            }
    
            // Free library
            FreeLibrary( hDWM );
        }
    }
    

    Lg Tobi


Anmelden zum Antworten