Solved

Resource.h File

Posted on 2000-02-18
3
728 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how to convert c++ code to Android App 3 110
FMX enumerated colours 2 119
is twain_32.dll cmpatible with windows 10 ? 10 195
How to split this in C++ 4 108
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
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 viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

821 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