Solved

resrc1.h file creation

Posted on 2004-08-23
27
566 Views
Last Modified: 2013-11-20
A dialog based app created using the app wizard contains as resource the res subdirectory and appname.rc and resource.h. But since while VS is creating resrc1.h (VC++ 6.0 SP5). I modified resource.h to assure unique IDs for all different (sub)dialogs to allow creating tooltips with string resource numbers identical to the control IDs. I don't know if this is the origin for creating resrc1.h in addition to resource.h. appname.rc is modified accordingly but all other source files which need resources have to include resource.h and resrc1.h from then on. And assuring unique IDs over 2 files seems more difficult than scanning a single file.

Does anyone know under which conditions this file gets created? Or better how to remove its necessity?
0
Comment
Question by:SteH
  • 15
  • 6
  • 6
27 Comments
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 11869408
I have VC 6 SP5, that still uses resource.h and haven't met this resrc1.h before.  (With the 1 in the name this sounds like an intermediate file - what happens if you disable your anti-virus software - is it norton?)
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 11869993
Dont have found any mention to this file in the Microsoft documentation, but you can #include it inside your app.h file or even in the project's stdafx file.
0
 
LVL 13

Author Comment

by:SteH
ID: 11870223
I have just written a simple utility to sort/rearrange control IDs for subdialogs which
assures unique IDs
can manipulate tab order
observer command ranges
Then I would need what can still go into resource.h and what needs to be put in resrc1.h since latter seems to be a continuation of resource.h which is still needed. The idea adding resrc1.h (and resource.h) to stdafx.h file would at least eliminate the need to include them into every projects source file has the drawback that a complete recompile is necessary for every change of dialogs resources. Latter could be a big increase in delelopment time.
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 11870338
I use to put manual resources or IDs in the res\myapp.rc2 file, never touch the resource.h file (unless the first time when migrating resource from other project). I assume the resrc1.h has the same mission.

0
 
LVL 13

Author Comment

by:SteH
ID: 11870389
Unfortunatly when adding string resources of copying controls from one (sub)dialog to another some control IDs got duplicated. How do you get them back to unique ones. I was left with duplicated ones even within a dialog resource. I wonder why the app still worked. And when you copy something from another app I see even more problems using cut and paste. The app wizard/class wizard is not very smart in that direction. Thats why I want to manipulate the resource.h file. Manual resource can be added to rc2 file no problem.
0
 
LVL 44

Assisted Solution

by:AndyAinscow
AndyAinscow earned 350 total points
ID: 11870680
copy/cut & paste is a nuisance.  I usually check/modify resource.h by hand (save changes first else your manual changes can be overwritten).

This resrc1.h.  Are you creating it yourself?  I thought you had found it had been created automatically and wanted to know why and what its purpose was.
0
 
LVL 13

Author Comment

by:SteH
ID: 11870883
It is created automatically when adding (modifying?) resource IDs. It contains none or a single newly created resouce and the numbers to use for the next IDs to create. Those are in synch with resource.h and the additions from that file.

The purpose is not unclear. I want to know why it is created instead of using/continuing to use resource.h or if there is a hidden purpose for it.
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 11870932
Back to my first comment - it could be an intermediate file.  Do you still get it if you have you anti virus software disabled?
0
 
LVL 13

Author Comment

by:SteH
ID: 11870971
Yes. Virus scan was disabled and a string resource added and removed from project. This creates and almost empty resrc1.h file as posted above.
0
 
LVL 13

Author Comment

by:SteH
ID: 11871424
I think I found the problem. Some parts of appname.rc got removed. Those contained the TEXTINCLUDE defines thus resource.h and afxres.h where not found/parsed correctly. Restored this part from version control and now resource.h gets used as before.

So now I need to find out how that part is used. I had to change all resource by hand to be english (US). How can I make this default for an obviously located VC++ version. (XP and VC++ are english version but either might be localized back to english from swiss (german).
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 11871502
About localizing: That will explain why you have duplicated resources (really them are not duplicated since have different languages).
When you create an application with appwizard, you specify default language.
I think you can change in your Project -> Settings -> Resource tab -> Language combo
0
 
LVL 13

Author Comment

by:SteH
ID: 11871865
I set all to english (US) but still some parts are in the appname.rc file of the home language model. No idea why I can't remove this since I don't want anything here. But the reason for creating resrc1.h was that the part

#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//

1 TEXTINCLUDE DISCARDABLE
BEGIN
    "resource.h\0"
END

2 TEXTINCLUDE DISCARDABLE
BEGIN
    "#include ""afxres.h""\r\n"
    "\0"
END

#endif    // APSTUDIO_INVOKED
got mixed up. After I removed all parts referring to resrc1.h it said it could not save to resource.h invalid directory. Correction this from an old version solved this part. What I am left with is that I have an empty part with default language resources for the country the PC is standing in.
0
 
LVL 55

Assisted Solution

by:Jaime Olivares
Jaime Olivares earned 150 total points
ID: 11871962
Maybe starting a new project again and carefully setting proper language, before inserting your resources. Sometimes it is better to start with a clean project and paste all your code.
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 13

Author Comment

by:SteH
ID: 11872408
Thx, a newly created dialog based app with english selected as language makes the different language parts disappear in the rc file.
0
 
LVL 13

Author Comment

by:SteH
ID: 11872445
Not really. Just discovered that it seems to be the default icon which gets no language added to it. It is displayed with the wrong one in the property since before changing it to be english as well there were no two languages in the rc file. When setting the icons language from non displayed at the side of the resource but the wrong one in the property restores the two language version of the rc file.
0
 
LVL 13

Author Comment

by:SteH
ID: 11872486
Every new resource added is not displayed as english if not set to it. Even though the rc file contains no language seperation. Is that a feature?
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 11872770
I experience the same with my projects in spanish, I always have to specify language in properties toolwindow for every resource I insert.
0
 
LVL 13

Author Comment

by:SteH
ID: 11872795
I am not really sure whether you would need. Only the value displayed as property is wrong since some of them are definitly english and the rc file contains only english language until you change the first resource to english.
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 11872860
I think those resource without specific language are considered Neutral
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 11878654
<Every new resource added is not displayed as english if not set to it.>

There is a default language specified.  Every resource is of that default UNLESS  specified otherwise.  (step 1 in wizard for creating new project - combo at bottom for default language).
0
 
LVL 13

Author Comment

by:SteH
ID: 11878684
But the resources created by the wizard are displayed (in the resource view) as having that default language english US in my case. The property dialog shows the same for them. Newly added resources have no entry in the resource view and the default language of VS in the property dialog (german (switzerland) in my case) which is incorrect!
0
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 350 total points
ID: 11879059
My previous comment turns out to be of dubious quality.  It seems to use the locale (control panel, regional options) as the defaut for new resources.   (Can't see the wood for the trees!).  Is yours set as german (swiss) ?   The resources language is only shown if the setting is different from that of the PC.
0
 
LVL 13

Author Comment

by:SteH
ID: 11879129
I hoped that everything is set to english (US). At least keyboard layout is. Where can I change the locale settings? One is for the OS I know. Can it be changed for VS?
0
 
LVL 13

Author Comment

by:SteH
ID: 11879158
I found it. Regional settings of WinXP were reset to german (Switzerland) I guess by some patches IT department did on the PC. I know I set to be US before.
0
 
LVL 13

Author Comment

by:SteH
ID: 11879169
I think I got a lot of answers now so its time to provide points.
0
 
LVL 13

Author Comment

by:SteH
ID: 11879222
And to summarize it seems to be that the property popup shows the OS locale if none is specified explicitly. This is for a app created to be of a different locale setting than that of the OS just wrong. The resource is of locale settings specified for the app as wanted.

Will MS do updates on that for VS 6?
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 11879414
Will MS do updates on that for VS 6?

personally snowballs in hell come to mind.  (ver 6 is old now)
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
ADO Memory leak with DELPHI 2007 37 155
Strange date stored 22 100
How to determine file rename from EventLog ? 2 36
if loop in java 3 114
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now