i need a message box to display 2 different sources of text. the first section of the text will contain: text1 db "The file selected is: ",0 and stored in my varable i have NameOfFile db 0 i need the name of file to display at the end of the text. so it would end up being something like: The file selected is Test.exe smurf This message was edited by smurf, on 5/14/2001 9:18:45 PM
Posted on 2001-05-14 21:17:00 by smurf
There are lots of ways of going about this, it depends on how much you will be doing, how you get the filepath, if you want to play with heaps, ect. The simplest way is to alloc a big buffer in .data for the filepath:

; make a 500+ character 
MyPath    BYTE  DUP(MAX_PATH+1) 0   buffer
; make another buffer large enough to hole everything
OutString BYTE  "The file selected is: ",0, DUP(MAX_PATH+1) 0
MAX_PATH is a convienent constant, it's the character count of the largest pathname windows allows. The 2nd buffer above not only contains the start of the string we want, it also has room for the largest filename. After you get the filename, adding it on is just one call:

invoke lstrcat, ADDR OutString , ADDR MyPath
Posted on 2001-05-14 22:05:00 by Ernie
smurf, Problem with "NameOfFile db 0" is that you have only allocated 1 byte in the string. For a buffer to write a file name into, you can do it either in the uninitialised DATA? section or as a LOCAL on the stack, .DATA? NameOfFile db 260 dup (?) or in a procedure, LOCAL NameOfFile[260]:BYTE Regards, hutch@pbq.com.au
Posted on 2001-05-14 23:09:00 by hutch--
thanks for the replies. the lstrcat api function was what i was looking for. smurf
Posted on 2001-05-15 06:51:00 by smurf