用Delphi中的消息内部的一些变量更改MessageBox的标题

use*_*396 3 delphi messagebox

如何在消息中使用一些变量来更改消息对话框的标题。我试过了

Application.MessageBox('x * y = ' + result, 'this is title', MBICONINFORMATION); 
Run Code Online (Sandbox Code Playgroud)

但是它显示一个错误,指出不兼容的类型:“字符串”和“ PAnsiChar”,我知道这是因为不允许使用“结果”变量。有解决办法吗?之前感谢

Kee*_*per 5

我建议您使用Format函数,如下所示:

Application.MessageBox(PChar(Format('x * y = %s', [result])), 'this is title', MB_ICONINFORMATION);