Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Resource.h File

Posted on 2000-02-18
3
Medium Priority
?
755 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 225 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

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…

715 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