示例#1
0
bool muiIsDwmEnabled()
{
	if (!ImportDWM())
		return false;						// Windows XP

	if (pSetWindowCompositionAttribute)		// Windows 8/8.1/10: DWM is always enabled
		return true;

	BOOL bEnabled = FALSE;					// Windows Vista/7: Ask if DWM is on
	if (FAILED(pDwmIsCompositionEnabled(&bEnabled))) 
		return false;
	
	return bEnabled != FALSE;
}
示例#2
0
BOOL IsCompositionEnabled()
{
	// check Composition is Enabled
	BOOL bCompositionEnabled = false;

	if (IsWinVistaOrLater()) {
		HRESULT (__stdcall * pDwmIsCompositionEnabled)(__out BOOL* pfEnabled);
		pDwmIsCompositionEnabled = NULL;
		HMODULE hDWMAPI = LoadLibrary(L"dwmapi.dll");
		if (hDWMAPI) {
			(FARPROC &)pDwmIsCompositionEnabled = GetProcAddress(hDWMAPI, "DwmIsCompositionEnabled");
			if (pDwmIsCompositionEnabled) {
				pDwmIsCompositionEnabled(&bCompositionEnabled);
			}
			FreeLibrary(hDWMAPI);
		}
	}

	return bCompositionEnabled;
}