Solved

Resource.h File

Posted on 2000-02-18
3
742 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

623 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