How can i put carriage return in a string using szCatStr or is it possible. In other words i want to seperate string info into different lines.

And most importantly will it work with the DrawText api.

Don't want to investigate consoles right now. Just using client area of standard window.

thanx in advance
Posted on 2003-01-03 16:11:44 by IwasTitan
I think you have to do the parsing yourself and copy / insert the text you got into a new buffer.
szCatStr can only add to the end of a String and not insert in the middle of it. DrawText will work with any Text no matter how many CRLF's there are.
Posted on 2003-01-03 17:09:14 by JimmyClif
Well if you're going to use szCatStr, can't you just use a string containing a crlf?

string1 db "stuff",0
string2 db "more stuff",0
crlf db 13,10,0 ;or is that 10,13?
buffer db 64 dup(0)

invoke szCatStr,addr buffer,addr string1
invoke szCatStr,addr buffer,addr crlf
invoke szCatStr,addr buffer,addr string2
invoke szCatStr,addr buffer,addr crlf
invoke MessageBox,0,addr buffer,0,0
Posted on 2003-01-03 17:20:11 by Will

i tied your method and all it does is add characters to the string.


I tried putting a carriage return into a new buffer but no go.
Posted on 2003-01-03 17:56:09 by IwasTitan
That's odd because right after I posted that code I actually threw together a little test app and the messagebox text looked like this:
more stuff

I've already deleted it, and can't remember if 10 is the cr or 13 is, but other than that it worked fine. Whether that'll work with DrawText I don't know, but the messagebox looked exactly like intended.

Posted on 2003-01-03 18:16:51 by Will
maybe you should be more detailed what you wanna do :) Show us an example and the code you tried :)
Posted on 2003-01-03 18:18:30 by bazik

The szCatStr proc works fine but if you need to concantenate a number of strings which include the CRLF pair, have a look at a procedure written by Alex (The Svin) called szMultiCat as it is very powerful and fast with this type of work.

Set up a buffer that is big enough to hold all of the string data you need and write a zero at the beginning so that it is read as a zero length string then use szMultiCat to appens as much as you like to it.

LOCAL buffer{256]:BYTE ; allocate a buffer

Write ascii 13 and 10 and 2 zeros to the CRLF buffer and then set up the szMultiCat proc to take each string and CRLF to get the string you want.

If it is string data that is fixed you can just write it in the .DATA section.

MyString db "Line one",13,10
db "Line two",13,10
db "Last line",0

Posted on 2003-01-03 18:48:04 by hutch--
I did a search for szMultiCat procedure but can't find a posting of the source code.

Any directional tips welcome.
Posted on 2003-01-03 20:29:36 by IwasTitan

I did a search for szMultiCat procedure but can't find a posting of the source code.

Any directional tips welcome.

Erm... you looked at the source code for the masm32.lib? :grin:
Posted on 2003-01-03 22:53:41 by bazik
ok..thought i did that
will retry
Posted on 2003-01-03 23:57:02 by IwasTitan

Here is a macro for simplifying the use of szMultiCat.

; ------------------------------------------------------
; macro for concantenating strings using the szMultiCat
; procedure written by Alexander Yackubtchik.
; USAGE strcat buffer,str1,str2,str3 etc ...
; buffer must be large enough to contain all of the
; strings to append. Limit is set by maximum line
; length in MASM.
; ------------------------------------------------------
strcat MACRO arguments:VARARG
txt equ <invoke szMultiCat,> ;; lead string
pcount = 0
FOR arg, <arguments>
pcount = pcount + 1 ;; count arguments
% pcount = pcount - 1 ;; dec 1 for 1st arg
txt CATSTR txt,%pcount ;; append number to lead string
FOR arg, <arguments>
IF @InStr(1,<arg>,<ADDR>) ne 0
txt CATSTR txt, <,arg>
txt CATSTR txt, <,ADDR arg> ;; append 'ADDR' + args
txt ;; put result in code

Posted on 2003-01-04 07:15:59 by hutch--
thank you.

Am i to take it that szMultiCat is in the masm32 library. I didn't see it in masm32lib.hlp. list.

I don't have it in any library. Did it come with the latest version of masm32?

Can someone post the original here so i can put it in the library.

Posted on 2003-01-04 11:13:27 by IwasTitan
Attached :)


It is in the standard installation of MASM32 v 7 so you may be using an earlier version.

Posted on 2003-01-04 17:12:02 by hutch--
No i don't think i'm using version 7
Posted on 2003-01-04 17:57:06 by IwasTitan