Click here to Skip to main content
15,921,577 members
Articles / Programming Languages / C++
Article

Order Resource File

Rate me:
Please Sign up or sign in to vote.
3.38/5 (4 votes)
20 Feb 2006 27.1K   223   14   7
OrderResourceFile sorts the #define values in the resource.h file in alphabetical order. The #define values are also renumbered in sequence, starting with the number 1024.

Introduction

OrderResourceFile sorts the #define values in the resource.h file in alphabetical order. The #define values are also renumbered in sequence, starting with the number 1024.

  1. Execute OrderResourceFile.exe in the same folder that has your "resource.h" file.
  2. Manually copy the new #define values from OrderResourceFile.txt to your "resource.h" file.

Background

This is a simple and useful tool for keeping your code clean.

Using the code

Select and copy (to the clipboard) the text lines above the "#define _APS" values from your OrderResourceFile.txt.

Open "resource.h" and carefully paste these values over the old #define values:

//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by MyProgram.rc
//

#define MYDIALOG_IDC_BUTTON_1 1024   // START PASTING HERE
#define MYDIALOG_IDC_BUTTON_2 1025
#define MYDIALOG_IDC_BUTTON_3 1026
#define WM_DIALOGSTATE_01 1027
#define WM_DIALOGSTATE_02 1028
#define WM_DIALOGSTATE_03 1029      // STOP PASTING HERE

// Next default values for new objects
// 
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE        201
#define _APS_NEXT_COMMAND_VALUE         32768
#define _APS_NEXT_CONTROL_VALUE         206
#define _APS_NEXT_SYMED_VALUE           134
#endif
#endif

Points of Interest

Sometimes Visual Studio .NET 2003 complains with an "end of file" error in resource.h if I paste in the areas not specified above.

History

Original article created.

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
Engineer
United States United States
C++, MFC, ActiveX, DirectShow, GDAL

Comments and Discussions

 
GeneralTwo controls with same id in resource file Pin
hariakuthota4-Sep-08 0:02
hariakuthota4-Sep-08 0:02 
Hi all i am new to the concepts of vc++.
In my application i have a edit box which i copied and tried to add a new edit control but when i checked in the resource.h file i have seen that both of these controls are having the same id...How can i resolve this issue....

Thanks in advance...
GeneralDangerous approach Pin
Damir Valiulin26-May-06 6:23
Damir Valiulin26-May-06 6:23 
AnswerRe: Dangerous approach Pin
DvssCoder19-Jun-06 17:45
DvssCoder19-Jun-06 17:45 
Generalcould be useful Pin
kzipperer3-Mar-06 1:43
kzipperer3-Mar-06 1:43 
Generalone doubt... Pin
Sumit Kapoor28-Feb-06 12:58
Sumit Kapoor28-Feb-06 12:58 
GeneralMaybe useful, but... Pin
YoSilver21-Feb-06 1:55
YoSilver21-Feb-06 1:55 
GeneralRe: Maybe useful, but... Pin
Chris Conn21-Feb-07 9:16
Chris Conn21-Feb-07 9:16 

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.