“HINSTANCE ShellExecuteW(HWND,LPCWSTR,LPCWSTR,LPCWSTR,LPCWSTR,INT)”

来源:互联网 发布:淘宝买lol账号流程 编辑:程序博客网 时间:2024/06/07 00:54


执行代码


#include<Windows.h>#include<stdio.h>int main() {HINSTANCE hres = ShellExecute(NULL, "open", "notepad", "D:\\ForCoding\\virustest1\\virustest1\\1.txt", "",SW_SHOW);UINT u = (UINT)hres;if (u < 33) {printf("%d", u);}getchar();return 0;}

严重性 代码 说明 项目 文件

错误 C2664 “HINSTANCE ShellExecuteW(HWND,LPCWSTR,LPCWSTR,LPCWSTR,LPCWSTR,INT)”: 无法将参数 2 从“const char [5]”转换为“LPCWSTR”virustest1 d:\forcoding\virustest1\virustest1\test1.cpp9


将所有的字符串前面加 L 即可:


HINSTANCE hres = ShellExecute(NULL, L"open", L"notepad", L"D:\\ForCoding\\virustest1\\virustest1\\1.txt", L"",SW_SHOW);

0 0
原创粉丝点击