-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdllTools.cpp
More file actions
27 lines (22 loc) · 730 Bytes
/
Copy pathdllTools.cpp
File metadata and controls
27 lines (22 loc) · 730 Bytes
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
#pragma once
#include "dllTools.h"
#ifdef QT_DEBUG
#include <iostream>
#endif
int loadDwmDll(HRESULT(WINAPI *&getDwmStatus_) (BOOL *ok),
HRESULT(WINAPI *&setDwmColors_) (DwmColor *color, UINT unknown),
HRESULT (WINAPI *&getDwmColors_) (DwmColor *color)
)
{
HMODULE hlib = LoadLibrary((LPCWSTR)L"dwmapi.dll"); // load the Window Manager API
if (!hlib) {
#ifdef QT_DEBUG
std::cerr << "Could not load dwmapi.dll" << std::endl;
#endif
return 0;
}
*(FARPROC *)&getDwmStatus_ = GetProcAddress(hlib, (LPCSTR)"DwmIsCompositionEnabled");
*(FARPROC *)&getDwmColors_ = GetProcAddress(hlib, (LPCSTR)127);
*(FARPROC *)&setDwmColors_ = GetProcAddress(hlib, (LPCSTR)131);
return 1;
}