透明背景
case WM_PAINT: {
printf("HH\n");
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hwnd, &ps);
HBRUSH brush = CreateSolidBrush(0x00000ff);
//FillRect(hdc, &ps.rcPaint, (HBRUSH)(COLOR_WINDOW + 1));
FillRect(hdc, &ps.rcPaint, brush);
EndPaint(hwnd, &ps);
return 0;
}
置顶
HWND mainWnd = CreateWindowEx(
//0 && WS_EX_TOOLWINDOW | WS_EX_TOPMOST, // Optional window styles. WS_EX_TOOLWINDOW 隐藏任务栏标签。WS_EX_TOPMOST 置于顶层。已有窗口使用SetWindowPos()修改。
// WS_EX_TOOLWINDOW可能拖动到系统状态栏,因此置顶
// WS_EX_TRANSPARENT 忽略消息
WS_EX_TOPMOST | WS_EX_TRANSPARENT,
CLASS_NAME,
);
SetWindowLong(mainWnd, GWL_EXSTYLE, GetWindowLong(mainWnd, GWL_EXSTYLE) | WS_EX_LAYERED);
SetLayeredWindowAttributes(mainWnd, RGB(255, 0, 0), 0, LWA_COLORKEY);