LONG wAttr = GetWindowLong(hWnd, GWL_EXSTYLE);
//设置windows style这样才能进行下面的SetLayeredWindowAttributes
SetWindowLong(hWnd, GWL_EXSTYLE, wAttr | WS_EX_LAYERED);
//用于描述分层窗口的不透明度的 Alpha 值。 类似于 BLENDFUNCTION 结构的 SourceConstantAlpha 成员。 bAlpha 为 0 时,窗口是完全透明的。 bAlpha 为 255 时,窗口不透明。
SetLayeredWindowAttributes(hWnd, 0, 0, 0x02);