2

How can I create a application window that is showing just the borders of the window, but i don't want to show the contents of the window itself. I mean i want to see the rest of the desktop or the others windows through the entire region of my window. No using transparences. Just draw the borders.

I suppose it's like detecting the messages WM_ERASEBKGND and WM_PAINT and doing nothing in these cases to force not painting in the contens, but I have tried and window is still drawing a white background.

How can i get it?

Justin Ethier
  • 131,333
  • 52
  • 229
  • 284
Tonatiuh
  • 41
  • 5
  • Are u using windows sdk? – Abhineet Mar 28 '10 at 06:29
  • Yes I'm using c++ and windows sdk with calls directly to RegisterClass( ... and CreateWindow( ... with my own windowProcedure( ... where i detect WM_ERASEBKGND, WM_PAINT etc – Tonatiuh Mar 28 '10 at 12:00
  • Did u assigned to object.hbrBackground = (HBRUSH) GetStockObject(NULL_BRUSH); or sth else.... If u have not assigned then assign this u will see the background image at the current window. And ur current window will have only its border – Abhineet Mar 28 '10 at 12:10

2 Answers2

0

As per my understanding,

If u r working in win32 application or wince application.

During the registering of class i.e Register of window class.

If object of WNDCLASS is wc . Assign the value for wc.hbrbackground as follows:

wc.hbrBackground = (HBRUSH) GetStockObject(NULL_BRUSH);

This will work i.e. u can see the background window things. But after that it will not clear the background window image from ur current window. For that u need to do something different. I hope once u apply this and u will come to know what i mean to say exactly.

Abhineet
  • 6,459
  • 10
  • 35
  • 53
  • I discovered the reason: Windows 7 ( and I guess vista too ) have system properties->performance options->USE VISUAL STYLES ON WINDOWS AND BUTTONS When I disable it, it works as I expected, but when I enable again ( default behaviour ), it always paint the background with the color specified in wc.hbrbackground or Black if NULL, or NULL_BRUSH, doesn't matter. Then when I resize the application, to resolutions aprox the size of desktop, the resize is not fluid because of the "automatic" background paint and I have not started to do anything. That's the point. – Tonatiuh Mar 28 '10 at 12:12
  • @Tonatiuh : ok let me check at my side – Abhineet Mar 28 '10 at 12:12
  • @Tonatiuh : Use InvalidateRgn function at WM_PAINT – Abhineet Mar 28 '10 at 12:25
  • InvalidateRgn( hWnd, NULL, with "FALSE" or "TRUE" ); Did it worked to you? Don't solve the problem here, still doing the same. Also if I resize the window with MoveWindow( ) method I can see, when debuging, that first the window is painted with background and later I receive the messages WM_ERASEBKGN and WM_PAINT, so i can't see how handle it if I get the control after background is automatically painted. – Tonatiuh Mar 28 '10 at 12:40
  • @Tonatiuh : yes it worked here.. U should assign TRUE for clearing the region when next WM_PAINT is called – Abhineet Mar 28 '10 at 12:42
  • Are you trying in windows 7 with "USE VISUAL STYLES ON WINDOWS AND BUTTONS" enabled? – Tonatiuh Mar 28 '10 at 12:54
  • BTW I have seen the responsible for this is the process "dwm.exe". It slows down the performance a lot on windows. – Tonatiuh Mar 28 '10 at 13:20
  • I have seen OSX operating system with very smooth windows movements for years and windows 7 is still not able to handle his internal management of GDI efficiently. Really annoying. Seems imposible to do an application for windows with really smooth and unflickered movements unless you go to fullscreen. It sucks. – Tonatiuh Mar 28 '10 at 13:25
0

Is creating and applying a region (CreateRectRgn, SetWindowRgn) an option for you? You could just cut out the client area. See here for details

Heinrich Ulbricht
  • 10,064
  • 4
  • 54
  • 85