我在C++ Builder中使用VCL Forms应用程序.我可以在某些代码中帮助显示带有YesNoCancel按钮的消息框,然后检测是否按下了是,否或取消按钮.
这是我的代码:
if(MessageBox(NULL, "Test message", "test title", MB_YESNOCANCEL) == IDYES)
{
}
Run Code Online (Sandbox Code Playgroud)
我包括以下内容:
#include <windows.h>
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
E2034无法将'char const [13]'转换为'const wchar_t*'
E2342参数'lpText'中的类型不匹配(想要'const wchar_t*',得到'const char*')
更新
这是我的代码:
const int result = MessageBox(NULL, L"You have " + integerNumberOfImportantAppointments + " important appointments. Do you wish to view them?", L"test title", MB_YESNOCANCEL);
Run Code Online (Sandbox Code Playgroud)
值:integerNumberOfImportantAppointments是一个整数.如何在消息框中显示?
我收到以下错误:无效的指针添加.
此外,我可以选择消息框的图标吗?这种情况下的一个问题.