Vinnie Falco
Vinnie Falco

Reputation: 5353

Win32: How do I make an HWND transparent to clicks?

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?

Upvotes: 3

Views: 1481

Answers (1)

Dan Byström
Dan Byström

Reputation: 9244

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

Upvotes: 1

Related Questions