Click here to Skip to main content
11,934,199 members (33,670 online)
Click here to Skip to main content
Add your own
alternative version


10 bookmarked

Find Orphaned Resource Constants

, 6 Feb 2004
Rate this:
Please Sign up or sign in to vote.
A Perl script to help locate #define's in your Resource.h file that are no longer referenced by your VS project.


You may have noticed that when using Visual Studio 6.0's resource editor, it doesn't do a great job of keeping your resource files clean. If you delete a resource from the editor, it doesn't usually delete the associated #define in your resource.h. While this isn't a huge problem (unless you are running out of constants in the valid ranges), it has always bugged me. I wrote a Perl script which will look at your .dsp, parse though the associated source files, and try to match the constants defined in your Resource.h file. Any constants that are not matched will be written to an output file Orphans.txt.

To use:

  1. You must have Perl installed.
  2. Call using:
> Perl <full path to dsp> [<Resource.h file>="Resource.h"]

Possible problems: I realize that files not included in the DSP may be using the constants defined in the Resource file. Since I couldn't think of any good way to find all the files that #include (somewhere down the chain) the resource.h file, I stuck with just those in the DSP. You may want to verify that the constants identified are truly not being used by any files in your projects. This script will at least narrow down the list for you.


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

Web Developer
United States United States
No Biography provided

You may also be interested in...

Comments and Discussions

GeneralOrphans.txt or new resource.h Pin
Herbert Yu23-Sep-04 9:07
sussHerbert Yu23-Sep-04 9:07 
General_APS_3D_CONTROLS should not be here Pin
Herbert Yu23-Sep-04 9:05
sussHerbert Yu23-Sep-04 9:05 
GeneralResorg Pin
Bart Duijndam24-Feb-04 11:12
sussBart Duijndam24-Feb-04 11:12 
QuestionWhere to install Perl from? Pin
DavidCrow11-Feb-04 11:20
memberDavidCrow11-Feb-04 11:20 
AnswerRe: Where to install Perl from? Pin
strtdusty11-Feb-04 18:30
memberstrtdusty11-Feb-04 18:30 
GeneralTry this Pin
John Miller10-Feb-04 17:08
memberJohn Miller10-Feb-04 17:08 
GeneralRe: Try this Pin
strtdusty11-Feb-04 18:32
memberstrtdusty11-Feb-04 18:32 
GeneralRe: Try this Pin
John Miller12-Feb-04 5:28
memberJohn Miller12-Feb-04 5:28 Pin
Uwe Keim8-Feb-04 20:31
sitebuilderUwe Keim8-Feb-04 20:31 
GeneralRe: Pin
Phil J Pearson10-Feb-04 9:24
memberPhil J Pearson10-Feb-04 9:24 

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.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.151126.1 | Last Updated 7 Feb 2004
Article Copyright 2004 by strtdusty
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid