Click here to Skip to main content
15,894,646 members
Articles / Desktop Programming / MFC

GuiToolkit MFC Extension

Rate me:
Please Sign up or sign in to vote.
4.53/5 (167 votes)
16 Aug 20044 min read 2.2M   38.6K   384   625
A set of MFC GUI classes which allow you to build applications with the new Microsoft interface style
In this article, you will learn about GuiToolkit which is a complete set of classes based on MFC. It allows you to build applications with nice and sophisticated interfaces such as Visual Studio .NET, Office 2003, etc.

Image 1

Introduction

GuiToolkit is a complete set of classes based on MFC, that allows you to build applications with nice and sophisticated interfaces such as Visual Studio .NET, Office 2003, etc. The primary target is to have a complete free library that can be used without restrictions and suitable to user or programmers needs. This class set includes file management, connection through ADO, up to complex user's interface classes.

Guitoolkit was developed based on Paul Dilascia’s classes (father of almost all of this kind of libraries), including features like a Menu System and a floating bar (Thanks Paul for let me “ruin” all its wonderful code, hope you understand that I did it with sincerely my best intention); about the NewMenu Class (written by Bruno Podetti). I used “Hook” system. As a principal fact, I have tried to focus on code simplicity, in the way that you could isolate a class to understand it. Don’t expect to find in this library complex classes embedded into other, or sophisticated programming techniques.

I’ve tried to respect and preserve original class names of different authors, so every class that doesn’t begin with “Gui”, wasn’t written by me. As you could see, I’m the author of the 9x% of this classes.

GuiToolkit Users Guide

The code is free to use, except code that is not written by me, anyways you cannot take total or partial control of this code. This library is distributed in the hope that it will be useful, but without any warranty, without even the implied warranty of merchantability or fitness for a particular purpose.

Take your time to understand the given examples, and how to use the classes. In any case, I appreciate that someone wants to document this library. This library has a few or a lot of troubles, I hope that you can understand and forgive these human failures, like: There’s no documentation available, and there’s not tech support and some bugs in Windows 98.

You can use this library as you want and to demonstrate good or bad programming techniques, for your commercial application, to play, for improve it and share with us changes and to make me feel that my job gave you a plus making free code, in other words you don’t have to ask anybody for permissions this code is FREE in the way you respect author’s rights that let me use their code; and if you want to give me some credits (your welcome!), or you could show me, tell me and give the personal satisfaction of watching your own GuiToolkit built apps! “I appreciate it a lot”.

You can criticize the code being respectful, insults can freely direct to me but exclude Paul Dilascia, Bruno Podetti and other authors that I mention in credits section; they’re not guilty about my creation.

New Features

  • OneNote ® Style MDI tabs
  • Office ® XP/2003 look
  • Auto hide dockable bars
  • Docking tab colors
  • Visual Studio .NET look
  • And all components that you already know!

If you want the latest changes, visit the library web page http://www.beyondata.com/.

Some Examples

Image 2

Office menu bar XP styles provided:

Image 3

You can dispose of almost all controls in a dialog box using the CGuiStaticStandar class and obtain an interface such as next image.

Image 4

View more http://www.beyondata.com/.

What Comes Next?

Many things should be improved in the close future, errors, more controls, a text editor, to improve some classes, windows docking, autohidden functions, etc.

Credit

  • Thanks to Paul Dilascia VC++ MFC Guru, to allow using his class set for the menu management, thanks a lot I learned a huge things of his code.
  • Thanks to Bruno Podetti for your splendid menu class.
  • Thanks to David Yuheng Zhao for your VisualStylesXP class.
  • Thanks to Mohammad Ahmad Khaleel for your Cgradient class.

History

  • 31st July, 2002 - Updated source code
  • 20th August, 2002 - Updated source code
  • 10th January, 2003 - Updated source code
  • 18th August, 2004 - Updated source code

License

This article has no explicit license attached to it, but may contain usage terms in the article text or the download files themselves. If in doubt, please contact the author via the discussion board below.

A list of licenses authors might use can be found here.


Written By
Colombia Colombia
My name is Francisco Campos, A developer as you.I have the title of Engineer of Systems of the Universidad Autonoma de Colombia.My real Job Information Security officer, experience in security assessment, applications, and other related subjects.

Francisco.camposg@outlook.com

Comments and Discussions

 
GeneralRe: How to convert this project to VS2005? Pin
00thilani24-Apr-08 18:02
00thilani24-Apr-08 18:02 
GeneralRe: How to convert this project to VS2005? Pin
mc1321326-Apr-08 10:16
mc1321326-Apr-08 10:16 
GeneralRe: How to convert this project to VS2005? Pin
voidr16-Jan-09 19:47
voidr16-Jan-09 19:47 
QuestionGetting Assertion Pin
rkshdixit7-Apr-07 2:43
rkshdixit7-Apr-07 2:43 
GeneralIn release version the auto/hide button of CGuiControlBar disapears Pin
PaulaPaziani14-Mar-07 8:44
PaulaPaziani14-Mar-07 8:44 
GeneralTrigger an action while clicking on CGuiFolder Pin
Christopher 20078-Mar-07 22:14
Christopher 20078-Mar-07 22:14 
GeneralFIX to update mini title bar after clicking tabs Pin
tommorris2-Mar-07 20:30
tommorris2-Mar-07 20:30 
GeneralThree Defect Fixes + One Enhancement Pin
Yogesh Dhakad8-Feb-07 22:38
Yogesh Dhakad8-Feb-07 22:38 
Well let's first talk about the defects;
What if the user does want to use our Tabs to navigate through the open documents and what if he wants to close any open documents NOT using Scroll close button. So we have two defects here;
1) When user closes the open documents by NOT using our scroll close button then we (Tab Window) go out of sync when the last document is closed.

2) If the user navigates through the open documents (i.e. switches to a different document making it as the MDIActive document)then we (Tab Window) go out of sync. We (Tab Window) are unable to sense this change and do not set the CORRECT tab depending upon the MDIActive document. This leads to user getting confused and can cause serious problems from the user's perspective.

3) CWnd* CGuiTabWnd::GetActiveWnd () const was not working correctly. Note that GuiToolkit does not use this function to retrive the ActiveWnd but uses CWnd* CGuiTabWnd::GetNumWnd(int m_numtab) const. It is more intutive to use this function and I corrected it since I needed that in one of the above defect fixes

4) This is rather an enhancement. The problem definition is - When we switch from one MDI window to another then in background we see a flicker. The new window getting activated is ALWAYS kept as smaller (SW_RESTORE) and the moment we activate it, it gets maximized (since in our app we normally show all the MDI windows in the maximized state while we are using MDITabbed enabled feature of GuiToolkit.
Now this flicker is NOT due to GuiToolkit. You could observe it on every MDI application. So what's the solution? I really sratched my head for sometime but could not come up a satisfactory solution. I would appreciate if anyone helps me to get a clean solution for this problem.

=========================================================================================
Fixes in the code:
1) In your GuiMDITabbed.cpp locate the function void CGuiMDITabbed::OnTimer(UINT nIDEvent) key in the following code fix;
// Defect fix for 1)<br />
// cleaning up the last document when it is closed NOT using scroll close button but normal Window Close.<br />
//<br />
if (0 == GetCount()){<br />
  GetParentFrame()->RecalcLayout();<br />
}


2) In the same file and function like #1 put this fix;
// Defect fix for 2)	<br />
	// Keep the CurrentTab in sync with the current MDIActive Window<br />
	//<br />
	CWnd* pMDIActiveChild = p->MDIGetActive();<br />
	CWnd* pTabActiveWnd = GetActiveWnd();<br />
	if(NULL != pMDIActiveChild && NULL != pTabActiveWnd){<br />
		// Check if we are in sync<br />
		if (pMDIActiveChild->GetSafeHwnd() != pTabActiveWnd->GetSafeHwnd()) {<br />
			SetCurtab(pMDIActiveChild->GetSafeHwnd());<br />
		}<br />
	}


Notice that I have added one more overloaded function called SetCurtab in the class CGuiTabWnd. Implement the function as follows;
BOOL CGuiTabWnd::SetCurtab(HWND hWnd)<br />
{<br />
	BOOL bRetVal = FALSE;<br />
	// Steps:<br />
	// Find this Window in our array and note the tab index at which we have this Window. Return FALSE if we are unable to find.<br />
	// Set that tab index to be the current one and Update ourself (note we don't update the MDIChild since it's already activated)<br />
	for (int iCont=0; iCont< m_Numtabs;iCont++)<br />
	{<br />
		CGuiTab* ct = (CGuiTab*) m_pArray[iCont];<br />
		if (ct->pParent->GetSafeHwnd() == hWnd){<br />
			if (m_iSelectTab != iCont) {				<br />
				m_iSelectTab = iCont;<br />
				Invalidate(); UpdateWindow();<br />
				bRetVal = TRUE;<br />
			}<br />
			break;<br />
		}<br />
	}<br />
<br />
	return bRetVal;<br />
}


3) Correct the function with the following code;
CWnd* CGuiTabWnd::GetActiveWnd () const<br />
{<br />
//YD	return m_Numtabs == -1 ? NULL : ((CGuiTab*) m_pArray [m_Numtabs])->pParent;<br />
	return m_Numtabs == -1 ? NULL : ((CGuiTab*) m_pArray [m_iSelectTab])->pParent;<br />
}


4) So here's my enhancement to reduce this flicker.
In file GuiTabWnd.cpp locate the function void CGuiTabWnd::SetCurtab(int m_numtab)
In this function locate the line of code that reads pParentNew->BringWindowToTop();
Comment out this line and change it with pParentNew->ShowWindow(SW_SHOWMAXIMIZED);

Note the flicker is NOT completely gone with this approach. But it gives a good visual feedback to the user when he switches the tabs and that too when your application is full of colors (that's the very purpose of using this GuiToolkit, I guess)

Last but not the least - I am very serious on basing one of my products on this toolkit. So if anyone knows a better solution or limitations of this toolkit in terms of memory etc let me know. I feel cracking the problems should not be problem but things should be fast in the memory, I mean the GUI refreshes should not hog or flicker when my application is doing a computation intensive task.

Please feel extremely feel to criticize and/or comment. Thanks.

Best regards,
Yogesh Dhakad
Product Development Manager
GeneralRe: Three Defect Fixes + One Enhancement Pin
Yogesh Dhakad8-Feb-07 23:20
Yogesh Dhakad8-Feb-07 23:20 
QuestionHow to use CPropertySheet and CPropertyPage like features with CGuiContainer? Pin
Yogesh Dhakad27-Jan-07 17:20
Yogesh Dhakad27-Jan-07 17:20 
AnswerRe: How to use CPropertySheet and CPropertyPage like features with CGuiContainer? Pin
Yogesh Dhakad7-Feb-07 16:09
Yogesh Dhakad7-Feb-07 16:09 
QuestionGot problem in adding a combo box in Gui_DevStudio solution bar Pin
KeanuLee9-Nov-06 22:08
KeanuLee9-Nov-06 22:08 
GeneralBug report : problem in closing tabbed windows in MDI Pin
abracada8-Nov-06 6:43
abracada8-Nov-06 6:43 
GeneralRe: Bug report : problem in closing tabbed windows in MDI Pin
dccmx8-Jul-07 3:37
dccmx8-Jul-07 3:37 
GeneralRe: Bug report : problem in closing tabbed windows in MDI Pin
nsaxena7-Aug-07 23:08
nsaxena7-Aug-07 23:08 
QuestionLink static Pin
Mr. S21-Oct-06 6:03
Mr. S21-Oct-06 6:03 
AnswerRe: Link static Pin
Mr. S21-Oct-06 8:05
Mr. S21-Oct-06 8:05 
GeneralFix for Control Notification Error Pin
K.Hill24-Aug-06 3:12
K.Hill24-Aug-06 3:12 
Generalhelp ! compiler error,thanks Pin
unakie19-Aug-06 6:02
unakie19-Aug-06 6:02 
GeneralRe: help ! compiler error,thanks Pin
manach25-Feb-07 20:45
manach25-Feb-07 20:45 
GeneralGuiDrawLayer constructor (tracing an error) Pin
meeper3428-Jul-06 6:14
meeper3428-Jul-06 6:14 
GeneralRe: GuiDrawLayer constructor (tracing an error) Pin
Mr. S21-Oct-06 8:10
Mr. S21-Oct-06 8:10 
QuestionRe: GuiDrawLayer constructor (tracing an error) Pin
2simple12-Dec-06 6:59
2simple12-Dec-06 6:59 
QuestionWhy I don´t get to create modeless dialog in my project using GuiToolKit interface? Pin
PaulaPaziani10-Jul-06 5:22
PaulaPaziani10-Jul-06 5:22 
QuestionHow to add the opened windows list in the window menu? Pin
charonpluton27-Jun-06 0:34
charonpluton27-Jun-06 0:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.