#include <iostream>
#include <graphics.h>
using namespace std;
int main()
{
initgraph(800, 600, 0);
HWND hwnd = GetHWnd();
::SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & (~(WS_CAPTION | WS_SYSMENU | WS_SIZEBOX)));
::SetWindowLong(hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) & (~(WS_EX_WINDOWEDGE | WS_EX_DLGMODALFRAME)) | WS_EX_LAYERED | WS_EX_TOOLWINDOW);
SetWindowPos(hwnd, HWND_TOPMOST, (GetSystemMetrics(SM_CXSCREEN) - getwidth()) / 2, (GetSystemMetrics(SM_CYSCREEN) - getheight()) / 2,getwidth(), getheight(), SWP_SHOWWINDOW
| SWP_FRAMECHANGED | SWP_DRAWFRAME);
SetLayeredWindowAttributes(hwnd, 0x000000, 0, LWA_COLORKEY);
setcolor(0x0000ff);
line(0, 0, 800, 600);
system("pause");
closegraph();
}
c++ 简单透明无边框窗体
最新推荐文章于 2024-07-19 23:00:20 发布