Search code examples
winapihwnd

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?


Solution

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