You need to tell Windows how to draw a layered window. MSDN says there are two ways; you almost certainly want SetLayeredWindowAttributes , since you do not want to change the code for the control painting.
So after
SetWindowLong(winId(), GWL_EXSTYLE, GetWindowLong(winId(), GWL_EXSTYLE) | WS_EX_LAYERED);
add
SetLayeredWindowAttributes(winId(), RGB(0,0,0), bAlpha, LWA_ALPHA);
(Adjusted, of course, for your needs).
Note that the layered window should be the top window in Windows 7 below; only Windows 8 and above support multi-level child windows.
source share