hwnd create_transparent_window(hwnd game_hwnd)
{
const char
*
window_name
=
"transparent"
;
WNDCLASSEXA window_class;
ZeroMemory(&window_class, sizeof(window_class));
window_class.cbSize
=
sizeof(window_class);
window_class.hCursor
=
LoadCursor(
0
, IDC_ARROW);
window_class.hInstance
=
GetModuleHandle(NULL);
window_class.lpfnWndProc
=
window_proc;
window_class.lpszClassName
=
window_name;
window_class.lpszMenuName
=
window_name;
window_class.style
=
CS_VREDRAW | CS_HREDRAW;
hresult result
=
RegisterClassExA(&window_class);
error(result,
"RegisterClassExA失败"
);
int
x, y, width, height;
get_window_size(game_hwnd, x, y, width, height);
hwnd transparent_hwnd
=
CreateWindowExA(WS_EX_TOPMOST | WS_EX_TRANSPARENT | WS_EX_LAYERED,
window_name, window_name, WS_POPUP, x, y, width, height, NULL, NULL, GetModuleHandle(NULL), NULL);
error(transparent_hwnd,
"CreateWindowExA失败"
);
SetLayeredWindowAttributes(transparent_hwnd,
0
, RGB(
0
,
0
,
0
), LWA_COLORKEY);
UpdateWindow(transparent_hwnd);
ShowWindow(transparent_hwnd, SW_SHOW);
return
transparent_hwnd;
}