-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgm82alpha.c
34 lines (29 loc) · 1.34 KB
/
gm82alpha.c
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
#include <windows.h>
#include <dwmapi.h>
#pragma comment(lib, "Dwmapi.lib")
#define GMREAL __declspec(dllexport) double __cdecl
#define GMSTR __declspec(dllexport) char* __cdecl
GMREAL __gm82alpha_setcomposite(double whandle, double enable) {
HWND window_handle = (HWND)(int)whandle;
if (enable>=0.5) {
SetWindowLong(window_handle,GWL_EXSTYLE,GetWindowLong(window_handle,GWL_EXSTYLE) | WS_EX_COMPOSITED);
MARGINS margins = {-1,-1,-1,-1};
DwmExtendFrameIntoClientArea(window_handle,&margins);
} else {
SetWindowLong(window_handle,GWL_EXSTYLE,GetWindowLong(window_handle,GWL_EXSTYLE) & ~WS_EX_COMPOSITED);
MARGINS margins = {0,0,0,0};
DwmExtendFrameIntoClientArea(window_handle,&margins);
}
return 0;
}
GMREAL __gm82alpha_setchromakey(double handle, double enable, double color) {
HWND window_handle = (HWND)(int)handle;
if (enable>=0.5) {
//SetParent(window_handle,NULL);
SetWindowLong(window_handle,GWL_EXSTYLE,GetWindowLong(window_handle,GWL_EXSTYLE) | WS_EX_LAYERED);
SetLayeredWindowAttributes(window_handle,((DWORD)color)&0x00ffffff,0xff,LWA_COLORKEY);
} else {
SetWindowLong(window_handle,GWL_EXSTYLE,GetWindowLong(window_handle,GWL_EXSTYLE) & ~WS_EX_LAYERED);
}
return 0;
}