我刚刚开始使用vc++ 2008。我只想看到一条消息(对话框)。我已将我的项目创建为 win32 项目应用程序。
我写了下面的代码来查看 MessageBox
MessageBoxW(NULL, "Window Registration Failed!", "Error!", MB_ICONEXCLAMATION | MB_OK);
Run Code Online (Sandbox Code Playgroud)
但我收到一个错误
错误 C2664:“MessageBoxW”:无法将参数 2 从“const char [28]”转换为“LPCWSTR”
这是什么错误?我需要做什么才能看到一个简单的消息框显示。
MessageBoxW采用“宽字符串”参数,因此L在每个字符串之前添加一个:
MessageBoxW(NULL, L"Window Registration Failed!", L"Error!", MB_ICONEXCLAMATION | MB_OK);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11324 次 |
| 最近记录: |