1

I'd like to workaround this bug. So I need to know if user display configuration under Window7 is using "Aero" or "Classic" style.

Is there a way to do that?

I tried QApplication::style()->objectName() but this alsways returns me "windowsvista" whatever style is selected....

jpo38
  • 20,821
  • 10
  • 70
  • 151

1 Answers1

1

That can be done with WinAPI. In case of Windows 7 (and possibly Vista, 8 and 10):

// true == Aero theme, false == Classic theme
bool isAeroEnabled()
{
    HMODULE library = LoadLibrary(L"dwmapi.dll");
    bool result = false;
    if (library) {
        BOOL enabled = false;
        HRESULT (WINAPI *pFn)(BOOL *enabled) = (HRESULT (WINAPI *)(BOOL *enabled))(GetProcAddress(library, "DwmIsCompositionEnabled"));
        result = SUCCEEDED(pFn(&enabled)) && enabled;
        FreeLibrary(library);
    }
    return result;
}

For older Windows versions please follow to Get Windows theme? question.

Community
  • 1
  • 1
svlasov
  • 9,923
  • 2
  • 38
  • 39