Solved

Resource.h File

Posted on 2000-02-18
3
709 Views
Last Modified: 2008-03-03
Hi, I have a dialog based app that has a four page property sheet and a lots of controls on it. I have just copied and pasted a couple of dialog boxes from another app into my dialog based app and now it is crashing. I am fairly certain that my code is right. I did stumble across the resource.h file and I discovered that the values assigned to the resources were no longer unique and some resouces shared the same number. I have looked in MSDN for help and they talk about ranges of value that resourses are allowed to occupy but I did not fully understand what I was reading. Can anyone tell me if resource value have to be unique? If so, then how do I fix them and change them to correct values, and what values that should be? Also, can anyone tell me if the resource files is even related to the problems I am experiencing? Thanks.
0
Comment
Question by:rose337
3 Comments
 

Expert Comment

by:Oliv
ID: 2534838
resource ID don't have to be unique as long as they aren't shared :
 I mean that you can have many non unique ID but they have to be fully and
clearly defined in each context.
For example I have in my app 2 functions which automatically extract roi from an image : one with threshold, one with isovalue : don't have made different resources for my dialog boxes, keep interesting resources by a simple copy-paste...
but in your case I think property pages are shared in the property sheet and what's make the difference.

This is question of ID's type too : you can have many non unique ID as you want as they're not same type ID : resource ID, command ID, etc...

hope that helps you
Oliv'
0
 
LVL 4

Expert Comment

by:captainkirk
ID: 2535604
Just to expand on Oliv's comments - if you have two dialog resources with the same ID, you have a problem, however, if you have one dialog resource and a string table entry, for example, with the same ID, that's not a problem. Just adjust the conflicting values in the resource.h file. If you have help ID's, you may need to get those into your resource.hm file as well.
0
 
LVL 11

Accepted Solution

by:
mikeblas earned 75 total points
ID: 2535956
I guess the rules for uniqueness can be explained with one sweeping statement:

Identifiers of any resource type must be unique throughout your resource file for all resources of that type. You can't have a string with the same ID as another string, for example. You can't have a dialog with the same ID as another dialog.

Control IDs are different than resource IDs. The IDs used for controls aren't really resource IDs. They're IDs for the child windows used once the controls are created. You can't use those values in FindResource(), for example.

As such, control IDs aren't influenced by the rule I state above. Control IDs only need to be unique within their containing dialog resource. That is, within the same dialog, no two controls can have the same IDs--even if they're different types of controls. It's perfectly OK to use the same ID for a control that appears in one dialog and for a control that appears in another dialog box.

Controls can also have a special ID of -1. That means they're static--you're not interested in giving the control a specific ID number, and the cotnrol's notifications aren't of interest to you. Very frequently, static text controls have a resource ID of -1. The VC++ resource editor shows IDC_STATIC for these guys.

I think that's a clear answer for you.

..B ekiM
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

746 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

9 Experts available now in Live!

Get 1:1 Help Now