|
Using a map<string, int=""> would be fine.
|
|
|
|
|
You can also use strings rather than integers to refer to your resource items. If you do not give resource names a #define value, then you can refer to them by the name as string value, rather than its integer equivalent.
|
|
|
|
|
i dont't want to use #define because i use stringtables for different languages.
a map seems to fit to my needs.
|
|
|
|
|
ronovice wrote: i dont't want to use #define
That is what I was trying to explain in my previous post. If you do not use #define then the resource names can be accessed by their actual name as extracted from your XML, no need for a map or any other type of transform.
|
|
|
|
|
i wanted to use LoadString method which will need as parameter a UINT, but i have only the string .
How can I get from resources the text associated with that UINT if i cant convert the string to UINT ID?
if there is another solution(even without using LoadString), I will gladly use it.
|
|
|
|
|
You could try using FindResourceEx()[^] rather than trying to access it directly. This should allow you to use the name as a string and also to select which language you wish the string to be in.
[edit]My apologies, this does not hold true for STRINGTABLE entries, although you could possibly use a user defined resource type.[/edit]
modified on Thursday, January 7, 2010 8:14 AM
|
|
|
|
|
Not possible.
IDS_VALUE is a #define, these are resolved by the preprocessor and are not preserved as strings anywhere in the object files.
...cmk
The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying.
- John Carmack
|
|
|
|
|
thanks! it was worth a try! i will use a map (as the best idea for the moment)!
|
|
|
|
|
cmk wrote: Not possible.
Untrue; if you do not equate a resource name to an integer value, then you can address it by the actual string name.
[edit]My apologies, this does not hold true for STRINGTABLE entries.[/edit]
modified on Thursday, January 7, 2010 8:12 AM
|
|
|
|
|
Yeah, RT_STRING's screw things up, you can't even FindResource() on them without jumping through hoops.
e.g.
Given: IDS_STRING as a String Table entry
// Fails
hnd = FindResource(mod, MAKEINTRESOURCE(IDS_STRING), RT_STRING);
// Works
id_string = MAKEINTRESOURCE((LOWORD(IDS_STRING)>>4)+1);
hnd = FindResource(mod, id_string, RT_STRING);
... let alone getting the size, or loading the string without using LoadString().
...cmk
The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying.
- John Carmack
|
|
|
|
|
|
I really must take my own advice, and test everything before posting suggestions.
|
|
|
|
|
|
Hi,
I want to open 2 dialogs at a time.For first one, im using domodal function. Inside the first dialog,im calling create function to open second dialog.
the code is executed successfully.Is not showing any error. while running the application,its not showing the second dialog.Can anyone please tell me whether this procedure is correct?
Thanks,
modified on Thursday, January 7, 2010 2:06 AM
|
|
|
|
|
from where you invoking second dialog? if you are invoking second modeless dialog box after first one, then it not going to work as DoModal is modal call.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
im invoking second dialog inside Initdialog() function of first dialog.
|
|
|
|
|
Check if "visible" is true for your second dialog's resource (properties panel in resource editor), if no, then set it to true and try, if that for some reason doesn't work, then call ShowWindow(SW_SHOW) on your second dialog after creating it. Does this help?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
Hi, How is the parent for the model less dialog?
|
|
|
|
|
Can we implement audio visualization using MCIWnd Functions.Thanks in advance.
|
|
|
|
|
I am working with visual c++ and i am using three bitmap buttons.I want my all buttons to change their position multiple times when i click only one of them???I donot know how to do this???can any one send me the code in visual c++???
|
|
|
|
|
Just use MoveWindow [^]
2 bugs found.
> recompile ...
65534 bugs found.
|
|
|
|
|
While converting some of my old dll which is currently compiled in VC6 and is also running successfully.
VC2005 compile is throwing compiler error for this piece of code :-
string MyReturn()
{
return string(reinterpret_cast<const char *>(vec.begin()), vec.size());
}
here return type string is STL::string and vec is stl::vector of type unsigned char and i am receiving following error :-
error C2440: 'reinterpret_cast' : cannot convert from 'std::_Vector_const_iterator<_Ty,_Alloc>'
to 'const char *'
with
[
_Ty=unsigned char,
_Alloc=std::allocator<unsigned char>
]
Conversion requires a constructor or user-defined-conversion operator,
which can't be used by const_cast or reinterpret_cast
Does anyone know or can give direction to solve above problem, i have tried many way myself, was successfull in using _myfirst member of vector to resolve the problem, but it started giving some other problem.
Thanks in advance
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Use another string constructor.
return string(vec.begin(), vec.end());
|
|
|
|
|
Nope not working :-
error C2665: 'std::basic_string<_Elem,_Traits,_Ax>::basic_string' : none of the 13 overloads could convert all the argument types
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
I tried this first before replying to you and it is working fine.
I used Visual Studio 2008
Here is what I tried -
vector<unsigned char> vec;
vec.push_back('A');
vec.push_back('B');
vec.push_back('C');
string s(vec.begin(), vec.end());
|
|
|
|