// You have to set an additional flag in the exStyle, or just add it when you CreateWindowEx.
SetWindowLong(hWnd, GWL_EXSTYLE, GetWindowLong(hWnd, GWL_EXSTYLE) | WS_EX_LAYERED);
// Use crKey as the transparency color.
COLORREF crKey = RGB(0, 0, 0);
//SetLayeredWindowAttributes(hWnd, crKey, 0, LWA_COLORKEY);
// Use bAlpha to determine the opacity of the layered window.
// When alpha 0 the window is completely transparent, when it's 255 the window is opaque.
SetLayeredWindowAttributes(hWnd, 0, 128, LWA_ALPHA);