所以我在我的程序中创建了第二个窗口,如:
#define WINDOW_CLASS_NAME "WINCLASSFULL"
WNDCLASSEX winclass;
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_CLOSE:
DestroyWindow(hwnd);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, msg, wParam, lParam);
}
return 0;
}
some function {
HINSTANCE hInstance = (HINSTANCE)GetModuleHandle(NULL);
// first fill in the window class stucture
winclass.cbSize = sizeof(WNDCLASSEX);
winclass.style = CS_DBLCLKS | CS_OWNDC |
CS_HREDRAW | CS_VREDRAW;
winclass.lpfnWndProc =WndProc;
winclass.cbClsExtra = 0; //reserve data space
winclass.cbWndExtra = 0; //
winclass.hInstance = hInstance; //set instance of application
winclass.hIcon = NULL;
winclass.hCursor = LoadCursor(NULL, IDC_ARROW); //load cursor type
winclass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); //set background brush
winclass.lpszMenuName = NULL;
winclass.lpszClassName = WINDOW_CLASS_NAME; //set Windows class name
winclass.hIconSm = NULL;
hWnd= CreateWindowEx(WS_EX_LAYERED, // extended style
WINDOW_CLASS_NAME, // class
"Demo", // title
WS_POPUP,
x,y,
width,height,
NULL,
NULL,
hInstance,// instance of this application
NULL))) // extra creation parms
}
现在我的问题是如果我申请
255可以是1-255之间的任何东西
SetLayeredWindowAttributes(hWnd,RGB(0,0,0),255,LWA_COLORKEY|LWA_ALPHA)
窗口是完全不透明的,我看不到它背后的任何东西
这是完全透明的:
SetLayeredWindowAttributes(hWnd,RGB(0,0,0),0,LWA_COLORKEY|LWA_ALPHA)
我怎样才能获得
SetLayeredWindowAttributes(hWnd,RGB(0,0,0),128,LWA_COLORKEY|LWA_ALPHA)
工作 - 即我可以部分地看到我的窗户在上面;并且部分地看到它后面的窗口。我在MSDN上检查了doco,但我显然错过了Refer Microsoft Library
答案 0 :(得分:2)
尝试仅指定LWA_ALPHA,
而不是LWA_COLORKEY
和LWA_ALPHA