Click here to Skip to main content
15,916,941 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to fix a transparent dialog on the desktop, I use this code for make the dialog transparent:

C++
// change opacity : 0 is transparent and 255 is opaque.
LONG ExtendedStyle = GetWindowLong( GetSafeHwnd(), GWL_EXSTYLE );
SetWindowLong( GetSafeHwnd(), GWL_EXSTYLE, ExtendedStyle | WS_EX_LAYERED );
SetLayeredWindowAttributes( 0, 150, LWA_ALPHA );

also I fix dialog on the desktop with this code:

C++
HWND ProgmanHwnd = ::FindWindowEx( ::FindWindowEx( ::FindWindow( L"Progman", L"Program Manager" ), NULL, L"SHELLDLL_DefView",L"" ), NULL, L"SysListView32", L"FolderView" ); 
::SetParent( m_hWnd, ProgmanHwnd );

I put both codes in OnCreate().

on Windows XP it works fine, but in win7 only one of them works, it means if I use both codes, the dialog will disappear, but if I comment one of them, the other one works fine.

Is there any idea about this strange problem?
Posted
Updated 29-Sep-11 2:51am
v2
Comments
Richard MacCutchan 29-Sep-11 8:52am    
You need to explain which one fails and what results you get.
Minoo Khazeni 1-Oct-11 0:09am    
I thought it's clear...
if I comment (for example) the codes related to change opacity, the second property works fine and the dialog will fix on the desktop, also if I comment the codes related to fix on the desktop, the first property will works fine and the dialog will become transparent, but if I use both of them, the dialog will disappear

1 solution

you better check the returned values. On W7 you may not get all handles.

Check for W7 and write something what works better ;-)
 
Share this answer
 

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