Click here to Skip to main content
15,917,645 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a Dialog that creates a window in ::OnCreate. I want to change the opacity of this dialog not the window. I Put this code in ::Oncreate too (before the code creating CWnd):
MIDL
LONG ExtendedStyle = GetWindowLong( GetSafeHwnd(), GWL_EXSTYLE );
SetWindowLong( GetSafeHwnd(), GWL_EXSTYLE, ExtendedStyle | WS_EX_LAYERED );
SetLayeredWindowAttributes( 0, 100, LWA_ALPHA );


this code makes both Dialog and Window transparent.
How can I set this attribute in my desired way?
Posted
Comments
Albert Holguin 3-Jul-11 13:20pm    
A dialog is a window... can you clarify what you're trying to do?
Minoo Khazeni 4-Jul-11 5:59am    
I have a parent window and a child window, I want to change the opacity of only the parent window.
Is it clear?

1 solution

Try it this way:

C++
ModifyStyleEx(0, WS_EX_LAYERED);
SetLayeredWindowAttributes(0, 255 * 0.50, LWA_ALPHA);
 
Share this answer
 
Comments
Minoo Khazeni 4-Jul-11 4:34am    
it didn't work. :(
any other solution?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900