Re: silly Q: How do I use the string table?
- From: "Michael Salamone" <mikesa#at#entrek#dot#com>
- Date: Tue, 26 Jun 2007 22:43:09 -0700
There is a "feature" in WinCE implementation. You can get a direct pointer to the resource so you don't need to make a copy (unless you need to do some sort of manipulation - i.e. need write access). Pass NULL for lpBuffer. Return can be cast to LPTSTR. You have to make sure you pass /n to rc.exe which NULL-terminates the strings in the resource section.
If you're going to try to build this for desktop it won't work. You need a buffer. Or write your own string lookup - it's easy enough to do - that will return a direct pointer (look in WinCE shared source code). Use that for both WinCE and desktop builds instead of LoadString.
--
Michael Salamone [eMVP]
Entrek Software, Inc.
www.entrek.com
"jp2code" <poojo.com/mail> wrote in message news:O5Xq$XCuHHA.1204@xxxxxxxxxxxxxxxxxxxxxxx
Thanks Rick.
Now, I'm looking at LoadString:
int LoadString(
HINSTANCE hInstance,
UINT uID,
LPTSTR lpBuffer,
int cchBufferMax
);
It seems like LoadString would require more overhead because now I have to create a buffer to receive the string before it can be used. If my program requires something like 200 KB of text now, the current executable should increase by at least 200 KB. Right?
What is the benefit of using LoadString (or, essentially, the String Table)? If all of my strings are defined now in a global file, it seems like I am making better use of space.
"Rick" wrote:Use the LoadString method. You need the current instance handle and the
String's ID. The InitInstance melthod will give you the Instance handle,
from there you can assign it to a global variable for later reference.
Rick D.
Contractor
.
- References:
- silly Q: How do I use the string table?
- From: jp2code
- Re: silly Q: How do I use the string table?
- From: jp2code
- silly Q: How do I use the string table?
- Prev by Date: RE: Pocket PC - Phone button problem
- Next by Date: Re: Support for XML in MFC applications
- Previous by thread: Re: silly Q: How do I use the string table?
- Next by thread: Re: Support for XML in MFC applications
- Index(es):