I know there are a lot of answers related with this question, but I read them all and still don't understand.
My target is to draw RGBA image on the top of all windows using WinAPI.
For this I make TOPMOST LAYERED TRANSPARENT window:
hWin = CreateWindowEx(WS_EX_TOPMOST | WS_EX_LAYERED | WS_EX_TRANSPARENT,
"WindowClass1",
"Title",
WS_POPUP,
posX,
posY,
width,
height,
NULL,
NULL,
hInstance,
NULL);
To load image from file I use stb_image.h.
And to draw the image I tried different functions, right now it is:
SetDIBitsToDevice(hdc,
0,
0,
width,
height,
0,
0,
0,
height,
pixels.data(),
&bmi,
DIB_RGB_COLORS);
Everything is draws, but without the alpha channel, I can only set the alpha for the whole window using:
SetLayeredWindowAttributes(hWin, RGB(200, 200, 200), /*alpha=*/255, LWA_ALPHA);
And also I tried: UpdateLayeredWindow()
Is it possible at all?