CJ60 Version 6.07 Readme

# MFC Extension Library
CJ60 Version 6.07 Readme

## MFC Extension Library - CJ60Lib ( Updated for Visual C++ 6.0)

This release is the result of your comments, and suggestions. I received several suggestions and bug reports, which I believe most have been addressed and fixed with this release. Please remember there is not a "team" of developers maintaining this code, only I, and it is done in my spare time, so you can expect some bugs. If you have comments or suggestions, feel free to drop me a line at kstowell@codejockeys.com

The original library (MFCXLib) was renamed to CJ60Lib, in order to break any links that may have been established with any applications using the old library, and to establish a version control system. The library has the same functionality as the old one, however, there have been several enhancements for compatibility with Visual C++ 6.0.

Follow these steps to setup your application to use CJ60Lib MFC extension library:

- In your project settings, select the General tab. Make sure that Microsoft Foundation Class is set to Use MFC in a shared DLL.
- In your project settings, select the Link tab. Set the Category to Input, and add ../Lib to Additional Library Path.
- While still in the Link tab, change Category to General. For Output Name (All Configurations), build to the ../Lib directory. This makes the execution and debugging easier, since both DLL and EXE are located in the same directory. An example of this would be: ../Lib/MyDemo.exe.
- Select the C/C++ tab next. Change Category to Preprocessor, and add ../Include to Additional Include Directories.
- The last step would be to add the following two lines of code to your StdAfx.h header file, which will import all exported classes, and grant access to your entire application:

#include <CJ60Lib.h>

In order to statically link to CJ60Lib, make the following changes:

- In your project settings, select the General tab. Make sure that Microsoft Foundation Class is set to Use MFC in a static library.
- You will need to copy the resources from the CJ60 library to your project. The easiest way to do this is to open the file CJ60Lib.rc, then drag and drop the resources into your project

This library was written for version 4.71 or later of comctl32.dll. If you have an older version, you can download the latest version from the Microsoft site. Follow this link if you have an older version of comctl32.dll. It is important to note that the library will not load if your comctl32.dll version is older than 4.71.

Build errors, what to do:

If you receive the following build error "#error : CJ60Lib requires a newer version of the SDK than you have!", this means that you most likely are using Visual C++ 5, and either do not have the platform SDK installed, or you have an older version. You will need to download the latest version from Microsoft. To get it, follow this link.

If you receive the following build error " Error: Can't find file CJ60Libd.lib." This means you haven't built the library yet. YOU NEED TO BUILD the library first, this will generate the .lib and .dll files needed by the examples.

Disclaimer:

This source code in this library may be used in compiled form in any way you desire, Source file(s) may be redistributed unmodified by any means PROVIDING they are not sold for profit without the authors expressed written consent, and providing that this notice and the authors name and all copyright notices remain intact. If the source code is used in any commercial applications then a statement along the lines of:

"Portions Copyright © 1998-99 Kirk Stowell" must be included in the startup banner, "About" box or printed documentation. An email letting me know that you are using it would be nice as well. That's not much to ask considering the amount of work that went into this. This software is provided "as is" without express or implied warranty. Use it at your own risk! The author accepts no liability for any damage/loss of business that this product may cause.

+

Components found in the library

Class Name: | Description:
CCJCaption |
CCJControlBar |
CCJDockBar |
CCJDockContext |
CCJExplorerBar |
CCJFlatButton |
CCJFlatComboBox |
CCJFlatHeaderCtrl |
CCJFrameWnd |
CCJListCtrl |
CCJListView |
CCJMDIFrameWnd |
CCJMiniDockFrameWnd |
CCJOutlookBar |
CCJPagerCtrl |
CCJSearchEdit |
CCJSizeDockBar |
CCJTabCtrlBar |
CCJTabView |
CCJToolBar |
CCoolBar |
CCoolMenuManager |
CFixMFCToolBar |
CFlatToolBar |
CHyperLink |
CMenuBar |
CModuleVersion |
CShellPidl |
CShellTree |
CSHFileInfo |
CSubclassWnd |

+

Library class overview

Most of the classes found above have been implemented into example projects which are now included in this download. Below you will find an overview of the classes found in this library:

+

Acknowledgements

This would not have been possible without the following authors making their code freely available:

- Joerg Koenig - For some ideas I got for the 3D borders and using controls in toolbars from his cool CToolBarEx class.
- Selom Ofori - For his classes on 'Browsing Shell Namespace'.
- Shekar Narayanan - For his 'Cool Looking Menu' article which inspired me to write the CCJOutlookBar control.
- Dirk Clemens - For his 'Sizing TabControlBar' class which I based CCJTabCtrlBar on.
- Paul DiLascia - For all of his great work at MSJ, and making his source code available to us.
- Chris Maunder - For use of his CHyperLink control, and all of his support and encouragement.
- Zafir Anjum - For putting together such an excellent site (www.codeguru.com), and making all those cool MFC resources available.
- Many thanks to Microsoft for making the source code available for MFC. Since most of this work is a modification from existing classes and methods, this library would not have been possible.
- And to the rest of you for not letting me rest until I updated this library (again). Many thanks to all of you, who have encouraged me to update the articles and code, and who sent in bug reports and fixes.

+

What's new in this release

+

Changes made in Version 6.04

- Added information on where to find the platform SDK.
- Added include file <shlobj.h> to SHFileInfo.cpp which was omitted.
- Fixed a compatibility issue with Visual C++ 5, where resource constants were defined in VC6 but not 5.
- Fixed static build error, removed typo in FixTB.cpp which was causing this, thanks to Steve Quick for pointing this out.
- Added resource files which were omitted by accident when I created the setup disk, these files are now included.
- Fixed bug when checking for comctl32.dll version, this is now fixed. Thanks to Steve Nebes for pointing this out.

+

Changes made in Version 6.05

- Added two files which were missing from the CJ60Lib\res directory.
- Fixed a bug with loading cursor in static builds.
- Fixed accelerator problem with CCJFlatComboBox control.

+

Changes made in Version 6.06

- Fixed problem with CTRL-TAB as mentioned by Pierre Guimont, however the bug still exists when you actually click on the view itself.
- Fixed the bug with the icons disappearing when you click a column in the flat header control, Thanks to Albert Gao for pointing this out.
- Fixed a typo in the OnLButtonUp() message in CCJControlBar class. There was an extra line of code, which was removed. Thanks to Ioannis Stamatopoulos for bringing this to my attention.
- Added support for multiple rows in the CCJTabCtrlBar class. Thanks to Rashid Thadha for this fix.
- Made some cosmetic changes to CCJControlBar, CCJFlatHeader and CCJExplorerBar classes to add a more "authentic look".

+

Changes made in Version 6.07

- Christopher Brown - Made some some modifications to correct icon resource leak, and eliminate screen flicker in CCJOutlookBar control.
- Changed images list's to pointer vars passed into CCJOutlookBar class.
- Fredfrik Mattsson - Added GetFileExt() to return the file extension in the class CSHFileInfo() per request.
- Michael Lange - Fix for memory leak in CMyItemData structure, added a destructor that calls text.Empty().
- Boris Kartamishev - Fix for resource ID bug in CCoolMenuManager class.
- Takehiko Mizoguti - Overloaded PopulateTree(LPCTSTR lpPath) in the class CShellTree to fill the tree based upon path.
- Jeremy Horgan - During accelerator key processing OnInitMenuPopup() calls ConvertMenu() which allocates a new CMyItemData for each menu item. This is memory is normally freed by a call to OnMenuSelect(), which is not called when processing accelerator keys. This results in a memory leak. This was fixed by modifying the ~CCoolMenuManager() destructor.
- Fixed repainting problem with CCJFlatHeaderCtrl() when header is moved or window is resized. The class now uses log font instead of hard coded Tahoma font.
- Phil Baxter - Fixed the following problems when tabs are added after creation with CCJTabCtrlBar:
  - The tab was created, but the ListView that was showing on the tab was not visible.
  - Get an assertion when the AddView function attempts to perform the AddTool function.
  - When a new view is added, although you set it to be the active view, it isn't raised to the top of the stack in the display.
  - got the tooltips to behave correctly when a tab is added and removed, in addition.
  - Added two new member functions:
    void SetViewToolTip(int nView, LPCTSTR lpszLabel);
    void SetViewToolTip(CRuntimeClass *pViewClass, LPCTSTR lpszLabel);
- Michael Manzo - Added CCJTabView, a view class which can be used as an alternative to CCJTabCtrlBar class. Class can also be used as a view in SDI and MDI applications.
- Gonzalo Pereyra - CCJControlBar calls default wnd proc if no context menu is defined
- Scott Killen - If your frame is not your main window in your app, you cannot dock a floating CCJControlBar. Changed (CFrameWnd*)AfxGetApp()->m_pMainWnd to (CFrameWnd*)m_pDockSite in CanDockDockBar() and DockSizeBar()
- Added further functionality to CCJCaption() class so that you can define text size, text color, border size, border and background color. Basically to create a look similar to Outlook's Captions.
- Added InitializeFlatHeader() to CCJListCtrl() and CCJListView(), in order to initialize the list control manually.
- Andrew Bancroft - Since we've already added the entire toolbar to the imagelist we need to increment nNextImage even if we didn't add this button to m_mapIDtoImage in the LoadToolbar() method in CCoolMenuManager().
- Added AfxRegisterWndClass() to create method to handle double clicks in order to enable toggle docking in the CCJControlBar class.
- Fixed tooltip related memory leak with CCJControlBar.
- Added compatibility for UNICODE builds.
- Ola Gunnars for creating DevStudio, Explorer and Outlook project wizards. These are now included in the CJ Extension Library download.
- Takehiko Mizoguti for the Japanese translation of CJ Extension resources, and for writing the CCJFrameInfo class.
- Changed CCJToolBar() class to handle both Office and DevStudio style to toolbars. To use Office toolbars, use the CreateEx() method, otherwise your toolbars will look like DevStudio.
- Patrick Bergeron has fixed the following bugs:
  - CJFlatButton.cpp - Moving the cursor over the flat button doesn't raise the button right away. We have to wait for the first timer message to arrive, which is a bit annoying. It gives the impression that the system isn't very responsive. So in the OnMouseMove method, we call OnTimer(1) to force the initial update of the button.
  - CJFlatButton.cpp - Sometimes, a CJFlatButton would stay in a raised state when moving the mouse quickly over the client area of a few CJFlatButtons. The reason turned out to be the use of a static (ahem, global) variable "bPainted".The simple fix for this was to put bPainted as a member variable ("m_bPainted") and use this member variable instead. Flat buttons are now much more responsive and behave correctly in all cases.
  - CJControlBar.cpp - I had a dialog nested in a CJControlBar. Unfortunately when I tried to dock it to the left or right, the bottom part of my dialog would be clipped off. Fix: When in docked mode, ::CalcDynamicLayout needed to return the desired size, while taking into account the size of the gripper bar (if any). Simply added a simple "+GetMinExt()" Now my dialog's bottom doesn't get clipped. Woo-ha.
  - CJControlBar.cpp - When nesting a CDialog based window inside a CJControlBar, the 3D rect drawn by ::OnEraseBkgnd would be overwritten by the top and left dialog borders. The problem was caused by the fact that in the ::OnWindowPosChanged() method, the rectangle which is used to move the window contains the border. A simple call to rc.DeflateRect(1,1) solved this problem.
  - CJControlBar.cpp - Added a call to UpdateWindow() in ::OnEraseBkgnd(). This helps with the flickering a bit, but I Am not sure this is the correct way to go. Incorporate at your own risks.
  - CJControlBar.cpp - Added 2 ASSERT()s in ::OnMouseMove(). This was not to fix a bug, but at one point I was seeing strange
  - things that lead me to add these asserts. They don't do anything bad, so why remove them?
- Gonzalo Pereyra - CJTabCtrlBarl.cpp - I wanted to trap NM_RETURN notifications in my CTreeView Class. I couldn't... It turns out that CControlbar::PreTranslateMessage() will eat all dialog messages...It will never get dispatched to my window. So i Overrided it in : CCJTabCtrlBar::PreTranslateMessage(). this will allow for message reflection and we will get NM_RETURN. I don't know if this a good solution but for now , it works.
- Philip Lee - CJFlatButton.cpp - the HICON returned by CButton::SetIcon should be destroyed using ::DestroyIcon.
- Paul Andreassen - CJControlBar.cpp and CJSizeDockBar.cpp - help with eliminating flicker in control bars.

This page was last updated on 03/14/99.