tags:

views:

52

answers:

1

How to make the Win32 APP Background Transparent? in C++ i want to make the background of the program to look like the desktop picture.

+4  A: 

Give it the WS_EX_TRANSPARENT extended window style, and handle WM_ERASEBKGND message by doing nothing.

This will make the transparent parts of your window transparent to mouse messages also, if you don't want that, then handle the WM_NCHITTEST message and return HTCLIENT rather than HTTRANSPARENT.

case WM_NCHITTEST:
   {
   lRet = DefWindowProc(hwnd, uMsg, wParam, lParam);
   if (HTTRANSPARENT == lRet)
      lRet = HTCLIENT;
   }
John Knoeller
I think that only works for child windows. WS_EX_LAYERED is a better mousetrap for top-level windows.
Hans Passant