Anyone know how to use String Resources in MASM?

ie. Create a string table with Resource work shop and have access to the ID's and string data. Want a way to not place tonnes of equates at the top of my source for all my controls on the dialog. I originally thought that it would just work, but if the equates are not at the top of the source then I get the undefined crap messages.

Posted on 2001-08-16 07:24:04 by Rock

Create your resource file using VC++ or another tool and use
LoadString API to retrieve them.

Posted on 2001-08-17 13:19:09 by Xtreme

Unless you have very good reason to use the resource file as a place to store string data, you are a lot better off putting it in the .DATA section of you program as normal BYTE data as string data is stored in a resource file in unicode format that is twice as long.

I don't know which assembler ypou are using but both TASM and MASM will handle INCLUDE files so if you don't want a mess of string data at the beginning of your file, put it all in a seperate file and include it at the beginning of you main source file.

Posted on 2001-08-17 19:37:10 by hutch--
hutch, unicode can be necessary to get international support for
some languages :(.

I would recommend using an external string file. It can be made so
much less messier than string resources (which require you to use
temporary buffers to load the strings into, *yuck*). I have done this
with success... in my (C) code, I can do a call to "lang_string(1042)"
to get a pointer to a string which I can use directly. ANSI at the moment,
but wouldn't be too hard to convert to unicode. And the idea would
work swell in assembler as well.
Posted on 2001-08-17 20:27:35 by f0dder
Thanx guys, I actually use your package Hutch!!! Great job by the way. I have used NAsm, TAsm in the past and used to think NAsm was the way to go, but when I found the MASM32 package on the net my opinion differred!!! A great package most certainly.

Back to the resource string issue. I perhaps threw some terms around I didn't intend(like string resource, haha)

What I would really like to see is a parser of some sort that can go through the .rc script file and then place all the identifiers(ie, IDM_MENU) into equates usable my MASM32.

bascially transform all the #defines into equ and then place this into its own .inc file

would be a nice tool!!!
Posted on 2001-08-18 11:03:23 by Rock
probably the lamest piece of code to ever be written by me or anyone else (but it works!), i present to you: resh2inc! :grin:
does exactly what you wanted Rock, but in an increadibly stupid way.
the reason why it's so big is that it's C, using C libraries.
who cares though, it works :tongue:

usage: resh2inc.exe <resource.h> <>
you can put this line in your makefile too, so it'll update automatically.
Posted on 2001-08-18 18:04:14 by fresh
thanx for the tool!! I'll try it out and see how it works. I After my last post I was almost considering powering up Delphi(God forgive me!!) and writing a parser myself. Whew, glad I didn't bother reinventing that bloody wheel again.

Posted on 2001-08-18 18:22:38 by Rock