Is there a way to use a string without first adding it to your .data section?

I have lots of info messageboxes that I need to use but don't want to add eveything for those to the .data, well unless I have to, haha

I am looking for something like this

invoke MessageBox, hWin, 'Text Here', 'Caption Name', MB_OK

Just wondering if there is a macro out there that can make something like this possible?

invoke MessageBox, hWin, Macro('Text Here'), Macro('Caption Name'), MB_OK

I am sure bitrake has some kick ass macro out there that probably does this perfectly. :)
Posted on 2002-01-05 14:29:39 by Rockinronstar
Posted on 2002-01-05 14:50:18 by savage
Would you consider using this CTEXT macro? It doesn't affect the state of MASM, and also allows for a null string. It's important not to effect the segment state of MASM in larger projects. Could also use '@CurSeg ENDS' to end the segment definition.


CONST segment
IFIDNI <y>,<>
sym db 0
sym db y,0
CONST ends

This can also be used in the DATA segment:
pArray: dd CTEXT('Hello'),CTEXT('World')
...the other macro can't do this.
Posted on 2002-01-05 15:07:28 by bitRAKE
Nice bitrake. Now a question... does masm have a "current segment"
define like nasm does? Not that I think you need it, you can probably
work around it in masm.
Posted on 2002-01-05 16:27:15 by f0dder
thanx bitrake, that was a dandy.
Have to admit, you know your way around MASM and macros.

wish I knew a fraction of what you do!!

I added that to my string Macro file.

I am trying to build a nice collection of include files for macros and other useful generic functions. Want to eliminate the "re-invent the wheel" problem.

I even have your cRGB you came up with in them as well

just as a niceness I do comment each function/Macro with its author. Should give credit when credit is due I think.

thanx again
Posted on 2002-01-05 17:02:24 by Rockinronstar

A macro design that was originally designed by HUH is one that I developed and put in the MACRO.ASM file in MASM32. It uses a macro called "literal" which is called by CTXT and SADD and between them, it automates the placement of string data in assembler code.

Have a look at these to see if they are of use in developing the macro type you require.

Posted on 2002-01-05 18:55:30 by hutch--
f0dder, @CurSeg is a text equate equal to the curent segment name. That is why you can do:
.data ; we are in data segment

.code ; we are in code segment
@CurSeg ENDS ; we are [b]not[/b] in a segment!
It is case sensitive.

The segment context can be viewed like a stack. The segment dot names reset the segment stack. But the long forms (ie _DATA segment) push a new segment type on the stack.

dd 01234567h
@CurSeg ENDS
dd 01234567h

_TEXT ENDS ; this line is in error because the dot name
; segment reset the segment context stack.
The context stack for the above is:
push _TEXT

mov esp,SegmentStackTop
push _DATA ; .data is _DATA

mov esp,SegmentStackTop
push _TEXT ; .code is _TEXT

pop _TEXT ; @CurSeg ENDS

; nothing on the stack!
pop _TEXT ; ERROR!
Hope you like my metaphor. :) The dot names are quick and easy, but I don't like them because you loose a feature of MASM by using them. It's not a big deal to do it the other way.

IIRC, first saw the CTEXT macro with segment switch in a post by japheth?
Posted on 2002-01-05 22:14:17 by bitRAKE
What can I say? Neat!
Posted on 2002-01-06 03:49:01 by f0dder
Heh.. im confused... time to reread this post....
Posted on 2003-05-03 10:40:24 by NaN

Heh.. im confused... time to reread this post....
Yeah, I'm using ASM code for a complex metaphor - don't view it as actual code, but rather just functionally equivalent. It was really clear in my mind when I typed it, but now seems too convoluted, sorry.
Posted on 2003-05-03 11:02:57 by bitRAKE