|
Joe Woodbury wrote: That goes without saying.
extern "C"<br />
{<br />
int WINAPI LoadStringW (HINSTANCE hInstance, UINT uID, LPWSTR lpBuffer, int nBufferMax)<br />
{<br />
return 0;<br />
}<br />
};
Results in a warning C4273: 'LoadStringW' : inconsistent dll linkage. dllexport assumed.
And my own function never gets called
|
|
|
|
|
I wouldn't overload LoadString directly. Rather I'd add a function like MyLoadString which would have smarts about what the current language is and all that. The advantage of this is that it could account for language neutral strings and whether satellite DLLs are used or not--in other words, the rest of your code wouldn't care where the strings are or how they are organized. For CString, you could have an overloaded version of MyLoadString that took a reference to a CString object and the ID (or you could always return a CString--there are many possibilities.)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Joe Woodbury wrote: I wouldn't overload LoadString directly. Rather I'd add a function like MyLoadString which would have smarts about what the current language is and all that.
That doesn't work, MFC as well as the UI toolkit calls LoadString for menus/toolbars
|
|
|
|
|
There is an article on CP somewhere that discusses this problem exactly. I'm having trouble finding it at the moment, but from what I remember about the article, each DLL was basically nothing more than a resource holder (specifically for string tables in different languages). The author added a menu item allowing the user to change the default language and the next time the program was run, it would load the dll for that language instead. If you do a little searching around CP, you can probably find it.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Thanks, but as already said I don't want to use satellite DLLs, I prefer to have a single exe to distribute.
|
|
|
|
|
Then your only hope is to put every language you want to support into your string table use an offset when loading strings. That is, every call to LoadString would look something like this:
CString str("");<br />
str.LoadString(IDS_MYSTRING + (iCurrentLanguage * ms_Offset));
This isn't very flexible since you have to make sure that a given string is offset exactly for each language.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
hello again
I have added new item in string table of my project :
IDS_SOMETHING "SomeText"
How to retrieve the string value of the IDS_SOMETHING in my project ?
thank you
|
|
|
|
|
Look at CString::LoadString
|
|
|
|
|
|
|
Hello
Can anybody explain what is a source control ? why is it useful ? and where can I download one.
thank you.
-- modified at 11:34 Tuesday 27th June, 2006
|
|
|
|
|
|
big_denny_200 wrote: what is a source control ?
It's a source files mamangement system.
big_denny_200 wrote: why is it useful ?
It manages source files:
1) Providing repository
2) Coordinating development in a team environment
3) Easying source code backup
4) Automating release configuration
5) etc.
big_denny_200 wrote: where can I download one
For Windows, Visual Studio Enterprise Edition provides "Visual Safe Source" tool. For free downloads, google "cvs for windows". For Linux, check out GNU websites for GNU CVS.
Best,
Jun
|
|
|
|
|
Try having a look at the first few chapters of Version Control with
Subversion[^], which talks about the Subversion[^] product.
Subversion is a pretty nice SCM/RCS product, BTW...
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
|
I am writing an expression evaluator, so I have come across the following head-scratcher:
We all know that for every type in the C++ world, we are able to declare either an actual instance of that type, or a pointer to that type. C++ natively supports up to two levels of indirection, if I am correct.
So, is the level of indirection an attribute of the type, or an attribute of the symbol that represents the instance of the type?
In other words, are there three different native types called:
char
pointer-to-char
pointer-to-pointer-to-char
OR is there really only one type
char
and the level of indirection is an attribute that belongs to the specific symbol being declared?
|
|
|
|
|
you can have as many levels of indirection as you want.
char *************** p = NULL; is perfectly valid.
Richie308 wrote: the level of indirection is an attribute that belongs to the specific symbol being declared
i believe this is correct.
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
Chris Losinger wrote: char *************** p = NULL; is perfectly valid.
Wow, I think you're right. I tried it, and it compiled without error!
This really answers my question, thank you Chris.
|
|
|
|
|
Chris Losinger wrote: you can have as many levels of indirection as you want.
char *************** p = NULL; is perfectly valid.
Its been a while, but I believe this is actually limited to something like 17 levels (not that you would ever need that many). I'd have to look it up myself, but I remember that the dimensions of arrays are limited to 17 (or somewhere around there) ... I believe pointer levels are as well.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Zac Howland wrote: something like 17 levels
just the thought makes me giggle.
char *****************p = NULL;
p = new char****************[n];
p[0] = new char***************[n];
p[0][0] = new char**************[n];
p[0][0][0] = new char*************[n];
p[0][0][0][0] = new char************[n];
p[0][0][0][0][0] = new char***********[n];
...
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
You laugh ... but sadly, I've seen people try to make 20-dimensional arrays and wonder why they get compiler errors ... not to mention logic errors :P
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
I really like your sig!
|
|
|
|
|
It's the first.
My reasoning: a pointer is a variable that stores an address, which is always 32 bit in a 32-bit OS, regardless of what type of instance it points to.
Best,
Jun
|
|
|
|
|
You listed 3 types:
char
ptr to char
ptr to ptr
They are not the same.
In the case of a pointer, it matters what type it points to in case you want to do arithmetic on the pointer value, such as incrementing it for example.
C++ allows any number of levels of indirection.
|
|
|
|
|
Hello there.
Does anybody know how to hide or don't show the child window caption in the "Windows" menu of its Client Window?
I don't want the "Windows" menu of a Client window show some of its childs windows captions.
Thanks.
|
|
|
|