我尝试执行命令到CMD,但它不起作用,包括:
#include <Windows.h>
#include <processthreadsapi.h>
#include <shellapi.h>
#include <stdio.h>
#include <iostream>
尝试打开记事本的方式:
ShellExecute(NULL, (LPCWSTR)"open", (LPCWSTR)"cmd", (LPCWSTR)"/c notepad.exe", NULL, SW_NORMAL);
这个管用
ShellExecute(NULL, L"open", L"cmd", L"/c notepad.exe", NULL, SW_NORMAL);
不要使用强制转换来移除编译器错误。 错误告诉您使用了错误的类型,请使用正确的类型。