⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vistaenhancements.h

📁 teamviewer source code vc++
💻 H
字号:
#pragma once

#define DWM_EC_DISABLECOMPOSITION         0
#define DWM_EC_ENABLECOMPOSITION          1

typedef DECLSPEC_IMPORT HRESULT (STDAPICALLTYPE *DwmIsCompositionEnabledFn) (__out BOOL* pfEnabled);
typedef DECLSPEC_IMPORT HRESULT (STDAPICALLTYPE *DwmEnableCompositionFn) (UINT uCompositionAction);

/*
CVistaEnhancements is a class that contains tool functions 
for special vista calls.

This class is a singleton class and cannot be instanced a second time.
The first instance is automatically created and available through 
variable VistaEnhancements.

*/
static class CVistaEnhancements
{
protected:
	//contains a handle to Desktop Window Manager API DLL 
	HMODULE library_dwmapi;
	// handles to query/set Desktop composition functions
	DwmIsCompositionEnabledFn m_isCompositionEnabled;
	DwmEnableCompositionFn m_EnableComposition;

	bool orig_composition;
public:
	CVistaEnhancements(void);
	~CVistaEnhancements(void);
public:
	/*
		isLoaded_dwmapi returns the load status of DWM DLL.

		@PreCondition(none)
		@PostCondition(none)

		@return(Returns true if the library is loaded (by load_dwmapi()) otherwise false.)
	*/
	bool isLoaded_dwmapi();

	/*
		isCompositionEnabled checks whether the vista composition (aero) is active.

		@PreCondition(1. library_dwmapi must be nonzero 
					  2. is_dwmapi_Available() must return true.)
		@PostCondition(none)

		@return(Returns true if composition is active otherwise false.It also returns false
		 if an error occured (DLL not loadable, Api not available))
	*/
	bool isCompositionEnabled();

	/*
		setComposition activates or deactivates the vista composition.

		@PreCondition(1. library_dwmapi must be nonzero 
					  2. is_dwmapi_Available() must return true.)
		@PostCondition(composition of vista is changed. no internal change)


		@parameter(doEnable If true the composition will be enabled otherwise disabled)
		@return(Returns true if the composition status could be changed otherwise false.)
	*/
	bool setComposition(bool doEnable);

	/*
		resetComposition sets composition to the original value
	*/
	void resetComposition() { setComposition(orig_composition); }

} VistaEnhancements;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -