Transparent Window

Is there anyway of making a transparent window on a Win32 platform with vc++?

Blokey
blokeyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

cdesignerCommented:
hmmm
what you want?

same transparent areas?

this can be made with regions
0
WynCommented:
Use region APIs

First construct a region ,then setwindowrgn() to set it.

Regards
Wyn
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
blokeyAuthor Commented:
is it possible to give me any examples?

Blokey
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

akalmaniCommented:
Hi blokey !!
   Set the extended window styles for the window i.e
WS_EX_TRANSPARENT  
Specifies that a window created with this style is to be transparent. That is, any windows that are beneath the window are not obscured by the window. A window created with this style receives WM_PAINT messages only after all sibling windows beneath it have been updated.

U can override PreCreateWindow() and set in the CREATSTRUCT of cs.exStyle.
0
cdesignerCommented:
0
akalmaniCommented:
Hi blokey !!
 I am sorry its
cs.dwExStyle = WS_EX_TRANSPARENT;
0
WynCommented:
Agree.
There are two ways.

One is using extra style ws_ex_transparent.When the wm_paint comes,you can only draw the part you want.

The second is using setwindowrgn(),this is more convenient.

E.G:
//First,let's create a region.

HRGN hgn;
hgn=CreateEllipticRgn(0,0,100,100);
 
//apply this region to the window

SetWindowRgn(hwnd,hgn,TRUE);

.............
//delete the created region
DeleteObjetc(hgn);

This example make your window as transparent elliptic contour.
You can use CombineRgn() to create a rgn which make your window has a hole and or so by specifying xor,or,and parameters in this function.

All in all,the region is the area your window appears in.If you construct a text region(using path),your window will transparent inbounding the region.

Best Regards
Wyn
 
 
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.