views:

143

answers:

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?

A: 

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.

Abhi
Still not working
Tonatiuh
I discovered the reason: Windows 7 ( and I guess vista too ) have system properties->performance options->USE VISUAL STYLES ON WINDOWS AND BUTTONSWhen 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
@Tonatiuh : ok let me check at my side
Abhi
@Tonatiuh : Use InvalidateRgn function at WM_PAINT
Abhi
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
@Tonatiuh : yes it worked here.. U should assign TRUE for clearing the region when next WM_PAINT is called
Abhi
Are you trying in windows 7 with "USE VISUAL STYLES ON WINDOWS AND BUTTONS" enabled?
Tonatiuh
BTW I have seen the responsible for this is the process "dwm.exe". It slows down the performance a lot on windows.
Tonatiuh
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
A: 

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