Link to home
Start Free TrialLog in
Avatar of Member_2_1001466
Member_2_1001466

asked on

resrc1.h file creation

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?
Avatar of AndyAinscow
AndyAinscow
Flag of Switzerland image

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?)
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.
Avatar of Member_2_1001466
Member_2_1001466

ASKER

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.
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.

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.
SOLUTION
Avatar of AndyAinscow
AndyAinscow
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
Back to my first comment - it could be an intermediate file.  Do you still get it if you have you anti virus software disabled?
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.
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).
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
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.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thx, a newly created dialog based app with english selected as language makes the different language parts disappear in the rc file.
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.
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?
I experience the same with my projects in spanish, I always have to specify language in properties toolwindow for every resource I insert.
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.
I think those resource without specific language are considered Neutral
<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).
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!
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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?
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.
I think I got a lot of answers now so its time to provide points.
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?
Will MS do updates on that for VS 6?

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