I\'m not talking about the vista glass feature, I already know how to accomplish that. The feature that I\'m talking about is add controls to the titlebar, like office 2007
As Franci mentions, what you want is DwmExtendFrameIntoClientArea. Here's an example from Codeproject that shows how to do it.
http://www.codeproject.com/KB/dialog/AeroNonClientAreaButtons.aspx
Joe Castro, a WPF product team developer, has an MSDN code gallery project called "WPF Chrome" that can be used to create an office 2007-like UI (ie: controls that span both the client, and non-client areas of a window).
Find it here: http://code.msdn.microsoft.com/chrome
You need to do some Win32 interop to achieve that effect. Depending on whether you are using Winforms or WPF, the way you hook to the message processing differs (I don't remember Winforms, so I'll give all examples for WPF). But in both cases, you need to:
Intercept the creation of the window and modify the window styles and extended styles. In WPF you need to inherit from HwndSource and modify the HwndSourceParameters in order to achieve this. You need WS_OVERLAPPEDWINDOW, WS_CLIPSIBLINGS and WS_VISIBLE for regular style and WS_EX_WINDOWEDGE and WS_EX_APPWINDOW extended styles.
Add a message handler throught he HwndSource parameters HwndSourceHook.
In the message proc added through the hook in step two, you need to process several messages:
Once you do the above, your client area where WPF is going to paint your visual tree is going to span the whole area of the window. You will need to add the "non-cliet" visuals so that your application looks like a regular application to the user.
You might need several more messages:
You might want to look at the Win32 Theme APIs if you want go get the standard Win32 assets for borders, caption, close, mininmize and maximize buttons to use in your 'non-client" area.
If you want to extend Glass into your window, you can look at:
You can find the proper C# definitions of all messages, styles and corresponding Win32 APIs you need on P/Invoke.
You could also achieve similar effect by using standard WPF window with a WindowStyle=none
. However, there will be some differences between the behavior of the desktop towards your app and other apps; most obvious of them is that you won't be able to stack or tile your window by right-clicking on the taskbar.
You can also look into some third-party components that enable some of this functionality. I have not used any (as you can see, I am not scared of Win32 interop :-)), so I can't recommend you any particular.
I've used the DotNetBar control suite with good success.