tags:

views:

135

answers:

1

I want an HWND that is transparent to clicks (i.e. passes them through to windows underneath).

At first I tried WS_EX_TRANSPARENT but that has all sorts of redraw problems. Windows underneath end up drawing over my HWND.

I did some searching and found a suggestion to respond to WM_NCHITTEST by returning HTTRANSPARENT. This seemed to work but MSDN states that it only works correctly when the windows underneath are in the same thread. Searching for HTTTRANSPARENT turned up some problems (http://www.virtualdub.org/blog/pivot/entry.php?id=147)

So...any other ideas?

+1  A: 

Catch all mouse messages and forward them to the underlying window with PostMessage.

danbystrom
Sounds great except...how do you find the window underneath? That works for all processes?
TheVinn
You'll have to enumerate all top level windows using GetWindow (http://msdn.microsoft.com/en-us/library/ms633515(VS.85).aspx) and check their positions. When you find one, you'll then use ChildWindowFromPoint (http://msdn.microsoft.com/en-us/library/ms633558(VS.85).aspx).
danbystrom