Originally Posted by
oogabooga
Are you asking for the window to be redrawn after you change the style?
No. I am trying to set WS_EX_LAYERED on the main window, created by CreateWindowEx, handle is hwndDlg. So I can then set the opacity to something < 100%. I found something interesting on msdn, saying reasons why this may occur.
After the CreateWindowEx call,
the layered window will not become visible until the SetLayeredWindowAttributes or UpdateLayeredWindow function has been called for this window. Note that WS_EX_LAYERED cannot be used for child windows.
However, i am calling SetLayeredWindowAttributes and the window still doesn't show. I have decided to try setting WS_EX_LAYERED when I create the window using CreateWindowEx. I tried calling SetLayeredWindowAttributes just before the call to ShowWindow but this still doesn't work.
-----ADDED----
I tryed the following (which still didn't work). Note: I did this instead of SetLayeredWindowAttributes:
Code:
BLENDFUNCTION bl;
bl.BlendOp = AC_SRC_OVER;
bl.BlendFlags = 0;
bl.SourceConstantAlpha = (255 * 80) / 100;
bl.AlphaFormat = AC_SRC_ALPHA;
UpdateLayeredWindow(hwndMain, NULL, NULL, NULL, NULL, NULL, 0, &bl, LWA_ALPHA);