注意:SetLayeredWindowAttribut
<span style="font-size:14px;">void CommonWnd::SetTransparentwnd()
{
SetWindowLong(this->GetSafeHwnd(),GWL_EXSTYLE,
GetWindowLong(this->GetSafeHwnd(),GWL_EXSTYLE)^0x80000);
HINSTANCE hInst = LoadLibrary("User32.DLL");
if(hInst)
{
//方法2
SetLayeredWindowAttributes(RGB(188,217,213),200,2);
FreeLibrary(hInst);
}
Invalidate(TRUE);
}
</span>
调用该函数即可!
附上:(MSDN查询结果)
Also by default, a child window (that is, one created with the WS_CHILD style and with a valid
parent hWnd parameter in the call to CreateWindow or CreateWindowEx) has the same layout as its parent.
To disable inheritance of mirroring to all child windows, specify WS_EX_NOINHERITLAYOUT in the call
to CreateWindowEx. Note, mirroring is not inherited by owned windows (those created without the
WS_CHILD style) or those created with the parent hWnd parameter in CreateWindowEx set to NULL. To
disable inheritance of mirroring for an individual window, process the WM_NCCREATE message with
GetWindowLong and SetWindowLong to turn off the WS_EX_LAYOUTRTL flag. This processing is in addition
to whatever other processing is needed. The following code fragment shows how this is done.
SetWindowLong (hWnd,