我正在尝试创建一个程序,当我单击主窗口上的一个按钮时,弹出一个辅助不可见窗口,上面有图纸,因此图像看起来好像是浮动的。然而,由于某种原因,没有"隐形"窗口变得透明。声明窗口类的代码是:
const char g_szClassName2[] = "invisWindow";
WNDCLASSEX invisWindowClass;
HWND invisHWnd;
invisWindowClass.cbSize = sizeof(WNDCLASSEX);
invisWindowClass.style = WS_EX_TRANSPARENT;
invisWindowClass.lpfnWndProc = WndProcedure2;
invisWindowClass.cbClsExtra = 0;
invisWindowClass.cbWndExtra = 0;
invisWindowClass.hInstance = hInstance;
invisWindowClass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
invisWindowClass.hCursor = LoadCursor(NULL, IDC_ARROW);
invisWindowClass.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
invisWindowClass.lpszMenuName = NULL;
invisWindowClass.lpszClassName = g_szClassName2;
invisWindowClass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
RegisterClassEx(&invisWindowClass);
我包含了WS_EX_TRANSPARENT样式,我认为这样会使我的客户区看不见。
隐形窗口的CALLBACK WndProcedure2的BUTTON CLICK case语句中的代码是:
const char g_szClassName2[] = "invisWindow";
const char WndName2[] = "invisible Window";
HWND invisWindowHandle = CreateWindowEx(0,
g_szClassName2,
WndName2,
WS_OVERLAPPEDWINDOW,
200,
200,
800,
500,
NULL,
NULL,
NULL,
NULL);
ShowWindow(invisWindowHandle, 3);
UpdateWindow(invisWindowHandle);
我可能做错了什么?