Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29236 Discussions

How do you get a multi-line message box

Intel_C_Intel
Employee
687 Views
I can get a multiline message box by including in the text.

But this doesn't work if I want to buld the message text from a combination of smaller text items.

I'm sure there must be a way to do this.

Thanks,
David

msg='This is line 1
This is line 2'c
iret=MessageBox(0,msg,'Title'c,MB_ICONINFORMATION)
msg='This is line 1
'//'This is line 2'c
iret=MessageBox(0,msg,'Title'c,MB_ICONINFORMATION)


The first example gives:
This is line 1
This is line 2

The second example gives:
This is line 1 This is line 2
0 Kudos
2 Replies
Steven_L_Intel1
Employee
687 Views
Here's how I do it:

CHARACTER(2), PARAMETER :: CRLF = CHAR(13)//CHAR(10)
...
msg = 'This is line 1'//CRLF//'This is line 2'C

You can even build up the line across several statements like this:

msg = 'This is line 1'
msg = trim(msg)//CRLF//'This is line 2'C

Note that only the last line uses the C string type - alternatively you could concatenate CHAR(0).

Steve
0 Kudos
Intel_C_Intel
Employee
687 Views
Thanks,

David
0 Kudos
Reply