Source Code
Home Downloads FAQ News Source Code Links


Search our Site:

sitemap

The source code listed here is free for the taking.  We only ask that you retain the developers' names in the files; other than that, you may use this code without restriction.  In each class, detailed step-by-step instructions on how to use the class can be found at the top of the ".H" header file.  

Please note that there are several dependencies among these classes, which are listed in the header files. Also, all classes are coded to automatically work correctly, whether they are compiled as part of an EXE or a DLL.

These classes have been in use for years, and are being continuously updated, corrected, and enhanced.  If you find a bug, please drop us a line, but be aware there is no support for any of these classes.  The developer's résumé is available here.

The source code on this page is supplied "as is".  The author disclaims all warranties, expressed or implied, including, without limitation, the warranties of merchantability and of fitness for any purpose. The author assumes no liability for damages, direct or consequential, which may result from the use of the source code on this page.

 

MFC Classes

FloatingText

Provides an interesting graphic display of multi-colored words floating on a white background.  The words to be displayed can come from the Registry, the String Table resource, or from a CStringList. 

 FloatingText.cpp    FloatingText.h

 

Generic

Most of the MFC class listed here use this class.  "Generic" is a collection of utility functions to handle a wide variety of chores.  View the header file for a listing.

Generic.cpp   Generic.h

 

MyAdoListCtrl

This is a simple that, given an ADO recordset, displays the data in a standard virtual list control, for unlimited number or rows.

MyAdoListCtrl.cpp    MyAdoListCtrl.h

 

MyApp

This CWinApp-derived class interfaces with the MyLog and MyTolTip class.

MyApp.cpp    MyApp.h

 

MyButton

This CButton-derived class allows you to place both text and images (bitmaps or icons) on a button.  Original code from msantoro@telerama.lm.com has been enhanced.

MyButton.cpp    MyButton.h    MyButton.rc2    MyButtonCancel.ico    MyButtonOk.ico    MyButtonResource.h

 

MyCheckListBox

Simplifies using a listbox full of checkboxes.

MyCheckListBox.cpp    MyCheckListBox.h

 

MyCrypto

Vastly simplifies using the Microsoft Crypto API.  This class implements RSA RC2 block encryption under MS CryptoAPI. This is by definition a 40-bit encryption scheme.

MyCrypto.cpp    MyCrypto.h

 

MyDepends

This class accepts the full path name of an EXE of DLL (or, by default, the currently executing program), and logs (using the MyLog class), all of the DLLs that the executable depends upon, along with information about each (such as version).  Very handy for debugging remotely.

(Virtually all of this code is from Matt Pietrek's article in the Microsoft Systems Journal, February 1997 issue; all I did was add a wrapper and consolidate it all into one H and one CPP file.

MyDepends.cpp    MyDepends.h

 

MyDevStudio

This CCmdTarget-derived class wraps automating the Microsoft Developer's Studio, and works for versions 5 and 6.  Using this class you can connect to a running instance of Dev Studio, open a file, and position to a given line.

MyDevStudio.cpp    MyDevStudio.h

 

MyDialog

This CDialog-derived class implements: an easy way to have "stretchy" dialogs; persistence of the dialog's screen placement to the Registry; and tool tips for its controls.

MyDialog.cpp    MyDialog.h

 

MyEdit

This CEdit-derived class has two main features. First, it can act as an extremely versatile masked edit control. Second, it supports a context menu to set the font, and can pop a dialog box to allow multi-line editing in a larger font. 

MyEdit.cpp    MyEdit.h    MyEdit.rc2    MyEditResource.h    MyEdit.bmp

 

MyExporter

This is a very simple implementation of writing data to various file types, using (mostly) ADO. The intention is to provide exporting support to applications as simply as possible.  The class uses design patterns to be easily extensible: currently XLS (Excel) and CSV (comma-separated values) are the only two implemented formats.

MyExporter.cpp    MyExporter.h

 

MyFileDeleteDlg

This is simply a wrapper around the MFC common file dialog; it allows for file deletion.

MyFileDeleteDlg.cpp    MyFileDeleteDlg.h    MyFileDeleteDlg.rc2    MyFileDeleteDlgResource.h

 

MyGraph

This CObject-derived class implements a very simple graph class using only the Win32 GDI routines.  It support pie, line, and bar graphs.

MyGraph.cpp    MyGraph.h

 

MyHyperlink

This CStatic-derived class implements a hyperlink control, with support for: underlining of links; variable fonts; tool tip; clicked, un-clicked, and hover colors; "hand" cursor; and a context menu. 

MyHyperlink.cpp    MyHyperlink.h    MyHyperlink.rc2    MyHyperlinkResource.h    MyHyperlink.cur    MyHyperlink.bmp

 

MyListBox

This CListBox-derived class lets you set the text color and background color each item in the listbox independently.

MyListBox.cpp    MyListBox.h

 

MyListCtrl

This CListCtrl-derived class implements many features, including: wrappers for "IsItem( )" and "IsColumn( )"; entire-row selecting; wrapper for focus and selection state of one or more items; bookmarking items; advanced searching; automatic sorting; multiple lines of text in each item; optional gridlines; persistence of column widths and sort order to the Registry; per-column tool tips; and user-settable per-column background colors.  Also corrects several Microsoft bugs and malfeatures.

MyListCtrl.cpp    MyListCtrl.h    MyListCtrl.rc2    MyListCtrlResource.h    MyListCtrl.bmp

 

MyLog

Most of the MFC classes listed here use this class for logging.  This class creates output both the a file and to the Dev Studio "Output" window, and supports variable arguments, automatic __FILE__ and __LINE__ logging, millisecond-level timestamping, automatic log file size management, multiple severity levels, and optional immediate flushing of each logged character to disk.   It can be enabled/disabled easily, or removed entirely for Release Mode builds.  Also, the messages it TRACEs to the "Output" window can be double-clicked on to take you to the __FILE__ and __LINE__ logged.  Includes a dialog box to allow the user to set the severity at runtime.

MyLog.cpp    MyLog.h    MyLog.rc2    MyLogResource.h

 

MyMDIClient

This CWnd-derived class allows your MDI Client window to display BMP files in centered, tiled, or stretch mode, or in a custom position.  Or, a color can be chosen using COLORREF values.  All state values can be persisted to the Registry.  Original code from Bogdan Ledwig (bogdanle@opole.mtl.pl).

MyMdiClient.cpp    MyMdiClient.h

 

MyMemoryDC

This is just a utility class used by several of the other MFC classes listed here; it supports off-screen blitting for flicker-free drawing.

MyMemoryDC.cpp    MyMemoryDC.h

 

MyMenu

This CMenu-derived class lets you adorn your application's menu with icons the way, for example, Microsoft Excel and Word do.  Original code contributors: Brent Corkum, Ben Ashley, Girish Bharadwaj, Jean-Edouard Lachand-Robert, Robert Edward Caldecott, Kenny Goers, Leonardo Zide, Stefan Kuhr, Martin Vladic, Kim Yoo Chul.

MyMenu.cpp    MyMenu.h

 

MyMessageBox

Has the following features: automatic support for an "Always Show This Message" checkbox (the state is stored in the Registry); accepts a String Table id or a CString; can set the title, message, and an optional detailed message; colors match the severity of the message (MB_ICONSTOP is red, etc.); supports "stretchiness", and remembers its size; supports tooltips.

MyMessageBox.cpp    MyMessageBox.h    MyMessageBox.rc2    MyMessageBoxResource.h    MyMessageBox.ico

 

MyModelessDlg

Simplifies displaying a modeless dialog with a message, an AV file, and a "Cancel" button.

MyModelessDlg.cpp    MyModelessDlg.h    MyModelessDlg.rc2    MyModelessDlgResource.h    MyModelessDlg.avi

 

MyProgressCtrl

This CProgressCtrl-derived class creates a progress control that does a gradient from one color to another, instead of one solid color.  (The best example of this kind of gradient is how Windows 98 does window title bars.)  Colors can be set explicitly via COLORREF values, or a flag can be set to have them chosen randomly.  The bar can optionally show the estimated time remaining.

MyProgressCtrl.cpp    MyProgressCtrl.h

 

MyPropertyPage

This class is an analog to the MyDialog class; it is meant for you to derive your property pages from instead of CPropertyPage. It provides support for printing and print preview, tooltips, and "stretchiness", 

MyPropertyPage.cpp    MyPropertyPage.h

 

MyRegistry

Many of the classes below use this class to persist their data to the Registry.  This class supports reading and writing CString's, string table entries, bool's, int's, UINT's, and binary data.  It can use bit masks to store multiple flag values in one DWORD.  It can do a poor man's encryption of values to prevent casual snooping in the Registry.  It supports deleting values, keys, and recursive key deletes.

MyRegistry.cpp    MyRegistry.h

 

MyRichEditCtrl

This extensive class provides support for a formatting toolbar (included) that handles bold, italic, underline, indenting, font/point-size selection, bulleting, numbering and color. Also included is clipboard support, printing and print preview, and a built-in context menu.

MyRichEditCtrl.cpp    MyRichEditCtrl.h    MyRichEditCtrl.rc2    MyRichEditCtrlResource.h    MyRichEditCtrlFormatBar.bmp    MyRichEditCtrlMenu.bmp    

 

MySax2

This class provides default implementations for Microsoft's SAX2 interfaces ISAXContentHandler, ISAXErrorHandler, and ISAXDTDHandler (part of their XML products housed in MSXML3.DLL).  The class also provides an example of how to write SAX-enabled code.

MySax2.cpp    MySax2.h

 

MySingleInstance

Encapsulates code that restricts your application to having only one running instance at a time, using a mutex based on your application's window class name.

MySingleInstance.cpp    MySingleInstance.h

 

MySpinCtrl

This CSpinButtonCtrl-derived class has support for DWORD range values (2 billion, instead of 32,767). Also corrects some annoyances in the base class, and makes buddy-ing with an edit control easier.

MySpinCtrl.cpp    MySpinCtrl.h

 

MyStatic

This CStatic-derived class is similar to the Visual Basic "label" control, and allows you to set fonts, point size, color, underline, bold, italics, fore- and background colors, the "sunken" and "border" attributes, and variable-speed foreground and background blinking (with user-specified timeout).

MyStatic.cpp    MyStatic.h

 

MyTipDlg

An improved "Tip of the Day" dialog box; tips are read from the string table.

MyTipDlg.cpp    MyTipDlg.h    MyTipDlg.rc2    MyTipDlgResource.h    MyTipDlgNext.ico    MyTipDlgPrev.ico    MyTipDlg.bmp

 

MyToolTipCtrl

An improved tooltip control, with support for an optional faint click sound.

MyToolTipCtrl.cpp    MyToolTipCtrl.h    MyToolTipCtrl.rc2    MyToolTipCtrlResource.h    MyToolTipCtrl.wav

 

 

ATL Classes

GenericAtl

This is the ATL version of my MFC class "Generic", but it is a work-in-progress.   Most of the utility functions in this class have been commented out, pending re-implementation under ATL.

GenericAtl.cpp    GenericAtl.h

 

MyAtlFileVersion

This class allows you to read the "version" resource info from EXE and DLL files.

MyAtlFileVersion.cpp   MyAtlFileVersion.h

 

MyAtlLog

This is the ATL version of my MFC class "MyLog", with a few extra features.  First, the log file created is an XML file (this will allow for custom, extensible log viewer applications to be written in the future).  Also, four levels of severity can be written (Audit, Error, Warning, and Trace).

MyAtlLog.cpp    MyAtlLog.h

 

MyAtlRegistry

An ATL class that handles Registry manipulation.  Does recursive deletes and probably everything else you need.

MyAtlRegistry.cpp   MyAtlRegistry.h

 

MyAtlSystemTray

Based on an MFC class created by P. J. Naughter, this class simplifies creating ATL programs that live in the system tray area.

MyAtlSystemTray.cpp   MyAtlSystemTray.h

 

MyCrypto

Implements the RSA RC2 block encryption algorithm under the Microsoft Crypto API.  This is by definition a 40-bit encryption scheme.  The MSCrypto API is notoriously difficult to get working correctly, but I haven't experienced any of the widespread claims of actual bugs.  This class is initialized with a password string of BYTES; then you can encrypt or decrypt byte-streams with one function call.

MyCrypto.cpp    MyCrypto.h

 

 

Java Classes

Assert

Since Java doesn't support condition compilation (like, #ifdef), these classes use a trick taken from Allen Holub (which I first saw in Thinking in Java, page 252).  The "asserts" appear only in your "Debug Mode" code, and disappear in your "Release Mode" code.

assert.java   assert_InDebugSubDir.java

 

Home ]

Translate this page automatically.
Send mail to webmaster@DefinitiveSolutions.com with questions or comments about this web site.
Copyright © 2005 Definitive Solutions, Inc.
Last modified: January 06, 2005
The Real Estate Ring
[ Join Now | Ring Hub | Random | << Prev | Next >> ]

The Real Estate Ring is a Division of Shadow Works