This article describes an easy to use, drop-in MFC class which replaces the standard title bar.
While creating an application with the Media Center 2005 look and feel, I noticed the title bar. I decided to recreate it and add it to one of my own ideas. I called it the "Ghost Drag". feature.
This project was built and tested on Windows 2000 and Windows XP using Visual Studio 6 SP5 and the Microsoft Platform SDK (Feb 2003).
Using the code
TBar class can be easily added to your window/dialog with a few easy steps.
- Add "TBar.h" and "TBAR.cpp" to your project.
- Include "TBar.h" in your main window/dialog class.
- Create a member variable of type
- (Optional) Add caption button images to your project.
- In the window initialization, create and setup the new title bar:
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
- Oct 4th 2006 - Origional article.
- Oct 6th 2006 - Bugs fixed / features added.
- Double clicking (maximize/restore) added.
- Disabled dragging while in maximized state.
- Added VS2003 solution file (TBarDemo.sln).
- Oct 11th 2006 - Bugs fixed / features added.
- Fixed bug regarding pressing one of the buttons and releasing the mouse outside of the window and the flickering problem.
- Added (by request) the ability to remove the close button.