加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

无法将参数2从’const char [14]’转换为’LPCWSTR’

发布时间:2020-12-16 09:43:30 所属栏目:百科 来源:网络整理
导读:我收到此错误: cannot convert parameter 2 from 'const char [14]' to 'LPCWSTR' 使用下面的代码.它应该是C,但最好是visual studio 2012提供一个空的c项目: #include "windows.h"int WINAPI WinMain (HINSTANCE hinst,HINSTANCE hprevinst,LPSTR cmdline,
我收到此错误:

cannot convert parameter 2 from 'const char [14]' to 'LPCWSTR'

使用下面的代码.它应该是C,但最好是visual studio 2012提供一个空的c项目:

#include "windows.h"

int WINAPI WinMain (HINSTANCE hinst,HINSTANCE hprevinst,LPSTR cmdline,int showcmd)
{
    MessageBox(NULL,"Merhaba Dunya","Merhaba",MB_OK);
    return 0;
}

什么是不正确的?

解决方法

似乎您的当前设置已设置,以便WinAPI函数期望宽字符串:

MessageBox(NULL,L"Merhaba Dunya",L"Merhaba",MB_OK);

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读