-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathWindWMAPI.cpp
More file actions
56 lines (48 loc) · 1.3 KB
/
WindWMAPI.cpp
File metadata and controls
56 lines (48 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/**
* 去掉标题之后添加边框阴影
*
* windwmapi.cpp
* 封装windows api的cpp文件。
*
* FlyWM_
* GitHub: https://github.com/FlyWM
* CSDN: https://blog.csdn.net/a844651990
*
*/
#include "windwmapi.h"
WinDwmapi::WinDwmapi()
: dwmapi_dll_(LoadLibraryW(L"dwmapi.dll"))
, dwm_is_composition_enabled_(NULL)
{
if (dwmapi_dll_) {
dwm_is_composition_enabled_ = \
reinterpret_cast<DwmIsCompositionEnabledPtr>(GetProcAddress(dwmapi_dll_, "DwmIsCompositionEnabled"));
dwm_extendframe_into_client_area_ = \
reinterpret_cast<DwmExtendFrameIntoClientAreaPtr>(GetProcAddress(dwmapi_dll_, "DwmExtendFrameIntoClientArea"));
}
}
WinDwmapi::~WinDwmapi()
{
if (dwmapi_dll_) {
FreeLibrary(dwmapi_dll_);
}
}
HRESULT WinDwmapi::DwmIsCompositionEnabled(BOOL *pfEnabled) const
{
if (dwm_is_composition_enabled_) {
return dwm_is_composition_enabled_(pfEnabled);
}
return E_NOTIMPL;
}
HRESULT WinDwmapi::DwmExtendFrameIntoClientArea(HWND hWnd, const MARGINS *pMarInset) const
{
if (dwm_extendframe_into_client_area_) {
return dwm_extendframe_into_client_area_(hWnd, pMarInset);
}
return E_NOTIMPL;
}
const WinDwmapi *WinDwmapi::instance()
{
static const WinDwmapi s_dwmapi;
return &s_dwmapi;
}