Click here to Skip to main content
13,000,982 members (59,413 online)
Click here to Skip to main content
Add your own
alternative version


11 bookmarked
Posted 7 Jul 2001

Add-in to create a class derived from CObject

, 7 Jul 2001
Rate this:
Please Sign up or sign in to vote.
Visual studio add-in to generate classes derived from CObject or subclasses. Includes serialization, Dump, AssertValid etc.

Sample Image - CreateObjectClass.gif


As many programmers have experienced, VC Class Wizard does not support generation of classes derived from CObject. Because most of my classes are derived directly or indirectly from CObject, I decided to create a simple add-in to do the job.


  • Generates subclasses from CObject or derived classes.
  • Options to support serialization and versionable schema
  • Options to support debugging, AssertValid and Dump
  • Optional support for Cocoon documentation generator
  • New generated files are added to the current project automatically
  • Options are automatically saved in the registry
  • Toolbar button to invoke the add-in


  • Copy files CreateObjectClass.dll and CreateObjectClass.chm to you add-in directory
  • Start Visual Studio
  • Select the menu "Tools"-"Customize ..." tab "Add-ins and Macro files"
  • Click the "Browse ..." button and select CreateObjectClass.dll

Now you see the CreateObjectClass toolbar, with one button. Click the button and just try it. Please refer to the help file for further details.

Known issues

  • Dynamic object creation is only supported through serialization.
  • Some day I will also support CCmdTarget derived classes (message maps)
  • For some reason the new class does not appear in Class View. I think this problem occurred when I switched to service pack 5. You may delete the .opt and the .ncb file of your project to repair this deficiency. If you have any solution, let me know.
  • With little effort it is possible to create the file base name programmatically.
  • The software would be easier to read if the files are generated in the OnOk() member function of CClassSpecificationDialog. I am to lazy to do so now.

Legal issues

You can use this software under the GNU public license conditions. Please let me know if you want to improve the code. If it makes sense, I can include it in the next release.

Source code

Sources are included in the download. The core is the class CClassSpecificationDialog. It is all rather straightforward. The dialog is invoked from the class CCommands in the function CCommands::CreateObjectClassCommandMethod().

You need Htmlhelp.lib in order to link. This library is included in Microsoft's HTML Help workshop.


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


About the Author

Rudolf Jan Heijink
Product Manager
Netherlands Netherlands
Got an MS degree in Electrical Engineering a long time ago (in the time before Computer Scince was invented as something you could study).Worked a long time as reseach engineer and project manager in software development. Then I did investment planning for my company, a big telecom operator. Now I work professionally as a product manager, responsible for service assurance at the same company. Programming is just one of the many things I like to do in my free hours.

You may also be interested in...

Comments and Discussions

GeneralQuery Pin
aruru11-Apr-05 3:11
memberaruru11-Apr-05 3:11 
GeneralRe: Query Pin
tomjey03-Jul-06 6:08
membertomjey03-Jul-06 6:08 
Generalbeginer Pin
dnqhung12-Jun-04 20:33
memberdnqhung12-Jun-04 20:33 
GeneralGood ... Pin
Ali Khanlarkhani21-Oct-02 0:34
memberAli Khanlarkhani21-Oct-02 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.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170624.1 | Last Updated 8 Jul 2001
Article Copyright 2001 by Rudolf Jan Heijink
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid